*/ use HasFactory, Notifiable; public function canAccessPanel(Panel $panel): bool { return true; } /** * Get the attributes that should be cast. * * @return array */ protected function casts(): array { return [ 'email_verified_at' => 'datetime', 'password' => 'hashed', ]; } public function roles(): BelongsToMany { return $this->belongsToMany(Role::class); } public function groups(): BelongsToMany { return $this->belongsToMany(Group::class); } public function todos(): HasMany { return $this->hasMany(Todo::class); } public function hasRole(string $role): bool { return in_array($role, $this->roles()->pluck('name')->toArray()); } }