User.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. class User extends Authenticatable implements FilamentUser
  10. {
  11. /** @use HasFactory<\Database\Factories\UserFactory> */
  12. use HasFactory, Notifiable;
  13. /**
  14. * The attributes that are mass assignable.
  15. *
  16. * @var list<string>
  17. */
  18. protected $fillable = [
  19. 'name',
  20. 'email',
  21. 'password',
  22. ];
  23. /**
  24. * The attributes that should be hidden for serialization.
  25. *
  26. * @var list<string>
  27. */
  28. protected $hidden = [
  29. 'password',
  30. 'remember_token',
  31. ];
  32. /**
  33. * Get the attributes that should be cast.
  34. *
  35. * @return array<string, string>
  36. */
  37. protected function casts(): array
  38. {
  39. return [
  40. 'email_verified_at' => 'datetime',
  41. 'password' => 'hashed',
  42. ];
  43. }
  44. public function canAccessPanel(Panel $panel): bool
  45. {
  46. return true; // 所有用户都可以访问面板
  47. }
  48. }