*/ protected $fillable = [ 'id', 'nama_depan', 'nama_belakang', 'tanggal_lahir', 'nik', 'email', 'password', 'role', 'nohp', 'alamat', 'foto_ktp', 'foto_wajah', 'foto_profile', 'persentase_kemiripan', 'status', 'gender', 'kode_kelurahan', 'remember_token', ]; /** * The attributes that should be hidden for serialization. * * @var array */ protected $hidden = [ 'password', 'remember_token', ]; /** * The attributes that should be cast. * * @var array */ protected $casts = [ 'email_verified_at' => 'datetime', 'password' => 'hashed', 'id' => 'string', 'status' => 'string', ]; //JWT /** * Get the identifier that will be stored in the subject claim of the JWT. * * @return mixed */ public function getJWTIdentifier() { return $this->getKey(); } /** * Return a key value array, containing any custom claims to be added to the JWT. * * @return array */ public function getJWTCustomClaims() { return []; } //JWT //Relasi public function pemilik_kontak(){ return $this->hasMany(Contact::class, 'email', 'pemilik_kontak'); } public function relasi_kontak(){ return $this->hasMany(Contact::class, 'email', 'relasi_kontak'); } public function pembeli(){ return $this->hasMany(Transaction::class, 'email', 'pembeli'); } public function penjual(){ return $this->hasMany(Transaction::class, 'email', 'penjual'); } public function village(){ return $this->belongsTo('Laravolt\Indonesia\Models\Village', 'kode_kelurahan', 'code'); } //Relasi //function alamat public function getVillageName(){ return $this->village->name; } public function getDistrictName(){ return $this->village->district->name; } public function getCityName(){ return $this->village->district->city->name; } public function getProvinceName(){ return $this->village->district->city->province->name; } }