User.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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='shop_account';
  13. /**
  14. * The attributes that are mass assignable.
  15. *
  16. * @var array
  17. */
  18. protected $fillable = [
  19. 'id','shop_id','account','password','mobile','status','ip',
  20. ];
  21. public function shop()
  22. {
  23. return $this->hasOne('App\Shop', 'shop_id', 'shop_id');
  24. }
  25. /**
  26. * The attributes excluded from the model's JSON form.
  27. *
  28. * @var array
  29. */
  30. protected $hidden = [
  31. 'password',
  32. ];
  33. public function getJWTIdentifier()
  34. {
  35. return $this->getKey();
  36. }
  37. public function getJWTCustomClaims()
  38. {
  39. return [];
  40. }
  41. }