User.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. namespace App;
  3. use Illuminate\Auth\Authenticatable;
  4. use Laravel\Lumen\Auth\Authorizable;
  5. use Illuminate\Database\Eloquent\Model;
  6. use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
  7. use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
  8. use Tymon\JWTAuth\Contracts\JWTSubject;
  9. class User extends Model implements AuthenticatableContract, AuthorizableContract, JWTSubject
  10. {
  11. use Authenticatable, Authorizable;
  12. /**
  13. * The attributes that are mass assignable.
  14. *
  15. * @var array
  16. */
  17. protected $fillable = [
  18. 'name', 'email','password'
  19. ];
  20. /**
  21. * The attributes excluded from the model's JSON form.
  22. *
  23. * @var array
  24. */
  25. protected $hidden = [
  26. 'password',
  27. ];
  28. protected $table = 'users';
  29. /**
  30. * Get the identifier that will be stored in the subject claim of the JWT.
  31. *
  32. * @return mixed
  33. */
  34. public function getJWTIdentifier()
  35. {
  36. return $this->getKey();
  37. }
  38. /**
  39. * Return a key value array, containing any custom claims to be added to the JWT.
  40. *
  41. * @return array
  42. */
  43. public function getJWTCustomClaims()
  44. {
  45. return [];
  46. }
  47. }