*/ use HasFactory, Notifiable, HasRoles; /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'name', 'email', 'password', 'can_login', 'active_sidebar', 'order' ]; /** * The attributes that should be hidden for serialization. * * @var array */ protected $hidden = [ 'password', 'remember_token', ]; public function canLogin(): bool { return $this->can_login; } public function getRoles() { return $this->roles->map(function ($role) { return "{$role->name}"; })->implode(' '); } public function employee() { return $this->belongsTo(Employee::class, "user_id"); } /** * Get the attributes that should be cast. * * @return array */ protected function casts(): array { return [ 'email_verified_at' => 'datetime', 'password' => 'hashed', 'can_login' => 'boolean', ]; } public static function getFillableFields() { return (new static())->getFillable(); } }