User.php 958 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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 JWTSubject,AuthenticatableContract, AuthorizableContract
  10. {
  11. use Authenticatable, Authorizable;
  12. public $table='user';
  13. /**
  14. * The attributes that are mass assignable.
  15. *
  16. * @var array
  17. */
  18. protected $fillable = [
  19. 'username', 'password',
  20. ];
  21. /**
  22. * The attributes excluded from the model's JSON form.
  23. *
  24. * @var array
  25. */
  26. protected $hidden = [
  27. 'password',
  28. ];
  29. public function getJWTIdentifier()
  30. {
  31. return $this->getKey();
  32. }
  33. public function getJWTCustomClaims()
  34. {
  35. return [];
  36. }
  37. }