User.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Contracts\Auth\MustVerifyEmail;
  4. use Illuminate\Database\Eloquent\Factories\HasFactory;
  5. use Illuminate\Database\Eloquent\SoftDeletes;
  6. use Illuminate\Foundation\Auth\User as Authenticatable;
  7. use Illuminate\Notifications\Notifiable;
  8. class User extends Authenticatable implements MustVerifyEmail
  9. {
  10. use HasFactory, Notifiable, SoftDeletes;
  11. const DEFAULT_SORT_BY = 'created_at';
  12. /**
  13. * The attributes that are mass assignable.
  14. *
  15. * @var list<string>
  16. */
  17. protected $fillable = [
  18. 'name',
  19. 'email',
  20. 'phone',
  21. 'password',
  22. 'role',
  23. 'color',
  24. 'token_fcm',
  25. ];
  26. /**
  27. * The attributes that should be hidden for serialization.
  28. *
  29. * @var list<string>
  30. */
  31. protected $hidden = [
  32. 'password',
  33. 'remember_token',
  34. ];
  35. /**
  36. * Get the attributes that should be cast.
  37. *
  38. * @return array<string, string>
  39. */
  40. protected function casts(): array
  41. {
  42. return [
  43. 'email_verified_at' => 'datetime',
  44. 'password' => 'hashed',
  45. ];
  46. }
  47. /**
  48. * Route notifications for the FCM channel.
  49. *
  50. * @return string
  51. */
  52. public function routeNotificationForFcm(): string
  53. {
  54. return $this->token_fcm;
  55. }
  56. }