*/ protected $hidden = [ 'password', 'remember_token', ]; /** * The attributes that should be cast. * * @var array */ protected $casts = [ 'email_verified_at' => 'datetime', 'created_at' => 'datetime', 'updated_at' => 'datetime', 'deleted_at' => 'datetime', 'password' => 'hashed', ]; public function getJWTIdentifier() { return $this->getKey(); } public function getJWTCustomClaims() { return [ 'email'=>$this->email, 'name'=>$this->name ]; } protected $with = ['roles']; public function roles() { return $this->belongsToMany( Role::class, UserRole::class, 'user_id', 'role_id' ); } public function department_access() { return $this->belongsToMany( Department::class, DepartmentAccess::class, 'user_id', 'department_id' ); } public function employees(): BelongsTo { return $this->belongsTo(Employee::class, 'employee_id', 'employee_id'); } public function employee_profile_picture(): BelongsTo { return $this->belongsTo(EmployeeProfilePicture::class, 'employee_id', 'employee_id') ->select(['employee_id', 'attachment']); } }