You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

User.php 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. namespace App\Models;
  3. use Filament\Models\Contracts\FilamentUser;
  4. use Filament\Models\Contracts\HasAvatar;
  5. use Illuminate\Database\Eloquent\Factories\HasFactory;
  6. use Illuminate\Foundation\Auth\User as Authenticatable;
  7. use Illuminate\Notifications\Notifiable;
  8. use Laravel\Fortify\TwoFactorAuthenticatable;
  9. use Laravel\Sanctum\HasApiTokens;
  10. use Wallo\FilamentCompanies\HasCompanies;
  11. use Wallo\FilamentCompanies\HasConnectedAccounts;
  12. use Wallo\FilamentCompanies\HasProfilePhoto;
  13. use Wallo\FilamentCompanies\SetsProfilePhotoFromUrl;
  14. class User extends Authenticatable implements FilamentUser, HasAvatar
  15. {
  16. use HasApiTokens;
  17. use HasFactory;
  18. use HasProfilePhoto;
  19. use HasCompanies;
  20. use HasConnectedAccounts;
  21. use Notifiable;
  22. use SetsProfilePhotoFromUrl;
  23. use TwoFactorAuthenticatable;
  24. public function canAccessFilament(): bool
  25. {
  26. return true;
  27. }
  28. public function getFilamentAvatarUrl(): ?string
  29. {
  30. return $this->profile_photo_url;
  31. }
  32. /**
  33. * The attributes that are mass assignable.
  34. *
  35. * @var array<int, string>
  36. */
  37. protected $fillable = [
  38. 'name', 'email', 'password',
  39. ];
  40. /**
  41. * The attributes that should be hidden for serialization.
  42. *
  43. * @var array<int, string>
  44. */
  45. protected $hidden = [
  46. 'password',
  47. 'remember_token',
  48. 'two_factor_recovery_codes',
  49. 'two_factor_secret',
  50. ];
  51. /**
  52. * The attributes that should be cast.
  53. *
  54. * @var array<string, string>
  55. */
  56. protected $casts = [
  57. 'email_verified_at' => 'datetime',
  58. ];
  59. /**
  60. * The accessors to append to the model's array form.
  61. *
  62. * @var array<int, string>
  63. */
  64. protected $appends = [
  65. 'profile_photo_url',
  66. ];
  67. }