*/ use HasFactory, Notifiable; /** * The attributes that are mass assignable. * * @var list */ protected $fillable = [ 'name', 'nip', 'email', 'phone', 'gender', 'address', 'division', 'position', 'profile_photo', 'password', 'role', ]; /** * 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', ]; } /** * Check if user is a superadmin */ public function isSuperAdmin(): bool { return $this->role === 'superadmin'; } /** * Check if user is a dokter */ public function isDokter(): bool { return $this->role === 'dokter'; } /** * Check if user is an apoteker */ public function isApoteker(): bool { return $this->role === 'apoteker'; } /** * Check if user can manage (create/edit/delete) resep */ public function canManageResep(): bool { return $this->isDokter(); } /** * Get user's reseps (prescriptions they created) */ public function reseps(): HasMany { return $this->hasMany(Resep::class); } }