12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. namespace App\Models;
  3. // use Illuminate\Contracts\Auth\MustVerifyEmail;
  4. use Filament\Models\Contracts\FilamentUser;
  5. use Filament\Panel;
  6. use Illuminate\Database\Eloquent\Factories\HasFactory;
  7. use Illuminate\Foundation\Auth\User as Authenticatable;
  8. use Illuminate\Notifications\Notifiable;
  9. use Spatie\Permission\Traits\HasRoles;
  10. class User extends Authenticatable implements FilamentUser
  11. {
  12. /** @use HasFactory<\Database\Factories\UserFactory> */
  13. use HasFactory, Notifiable, HasRoles;
  14. /**
  15. * The attributes that are mass assignable.
  16. *
  17. * @var list<string>
  18. */
  19. protected $fillable = [
  20. 'name',
  21. 'email',
  22. 'password',
  23. ];
  24. /**
  25. * The attributes that should be hidden for serialization.
  26. *
  27. * @var list<string>
  28. */
  29. protected $hidden = [
  30. 'password',
  31. 'remember_token',
  32. ];
  33. /**
  34. * Get the attributes that should be cast.
  35. *
  36. * @return array<string, string>
  37. */
  38. protected function casts(): array
  39. {
  40. return [
  41. 'email_verified_at' => 'datetime',
  42. 'password' => 'hashed',
  43. ];
  44. }
  45. public function canAccessPanel(Panel $panel): bool
  46. {
  47. // return str_ends_with($this->email, '@yourdomain.com') && $this->hasVerifiedEmail();
  48. return true;
  49. }
  50. }