*/ use HasApiTokens, HasFactory, HasUlids, Notifiable; /** * The attributes that are mass assignable. * * @var list */ protected $fillable = [ 'organization_id', 'name', 'first_name', 'last_name', 'department', 'job_level', 'direct_manager_id', 'email', 'password', 'role', 'status', 'locale', 'timezone', ]; /** * The attributes that should be hidden for serialization. * * @var list */ protected $hidden = [ 'password', 'remember_token', ]; /** * Get the attributes that should be cast. * * @return array */ protected function casts(): array { return [ 'email_verified_at' => 'datetime', 'password' => 'hashed', 'role' => UserRole::class, 'status' => AccountStatus::class, ]; } public function organization(): BelongsTo { return $this->belongsTo(Organization::class); } public function teams(): BelongsToMany { return $this->belongsToMany(Team::class, 'team_memberships')->withTimestamps(); } public function managedTeams(): BelongsToMany { return $this->belongsToMany(Team::class, 'team_managers')->withTimestamps(); } public function directManager(): BelongsTo { return $this->belongsTo(self::class, 'direct_manager_id'); } public function directReports(): HasMany { return $this->hasMany(self::class, 'direct_manager_id'); } }