User.php 949 B

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