User.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace App\Models;
  3. use Tymon\JWTAuth\Contracts\JWTSubject;
  4. use Illuminate\Notifications\Notifiable;
  5. use Illuminate\Database\Eloquent\SoftDeletes;
  6. use Illuminate\Foundation\Auth\User as Authuser;
  7. class User extends Authuser implements JWTSubject
  8. {
  9. use Notifiable;
  10. // use SoftDeletes;
  11. // protected $fillable = ['nickname','realname','phone','hard_num','simple_num','old_num','promise_num','status','created_at','','',''];
  12. //
  13. // protected $hidden = ['password'];
  14. // Rest omitted for brevity
  15. /**
  16. * Get the identifier that will be stored in the subject claim of the JWT.
  17. *
  18. * @return mixed
  19. */
  20. public function getJWTIdentifier()
  21. {
  22. return $this->getKey(); /*自己可以定义的生成token的参数,我用的是将主键加密*/
  23. }
  24. /**
  25. * Return a key value array, containing any custom claims to be added to the JWT.
  26. *
  27. * @return array
  28. */
  29. public function getJWTCustomClaims()
  30. {
  31. return [];
  32. }
  33. // public $timestamps = false;
  34. //定义表
  35. protected $table = "users";
  36. }