User.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace App\Models;
  3. use Tymon\JWTAuth\Contracts\JWTSubject;
  4. use Illuminate\Auth\Authenticatable;
  5. use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
  6. use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
  7. use Illuminate\Database\Eloquent\Model;
  8. use Laravel\Lumen\Auth\Authorizable;
  9. class User extends Model implements AuthenticatableContract, AuthorizableContract, JWTSubject
  10. {
  11. use Authenticatable, Authorizable;
  12. protected $table='users';
  13. protected $hidden = [
  14. 'password','created_at','updated_at','address'
  15. ];
  16. protected $fillable = [
  17. 'name',
  18. 'no',
  19. 'cre_num',
  20. 'telphone',
  21. 'team_id',
  22. 'address',
  23. 'cert',
  24. 'openid'
  25. ];
  26. public $timestamps = true;
  27. public function getDateFormat(){
  28. return time();
  29. }
  30. public function getJWTIdentifier()
  31. {
  32. return $this->getKey();
  33. }
  34. public function getJWTCustomClaims()
  35. {
  36. return [];
  37. }
  38. // public function getJWTCustomClaims()
  39. // {
  40. // return [];
  41. // }
  42. }