Admin.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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 Authenticatable;
  7. use Illuminate\Database\Eloquent\Model;
  8. class Admin extends Authenticatable implements JWTSubject # 这里别忘了加
  9. {
  10. use SoftDeletes;
  11. use Notifiable;
  12. // Rest omitted for brevity
  13. /**
  14. * Get the identifier that will be stored in the subject claim of the JWT.
  15. *
  16. * @return mixed
  17. */
  18. public function getJWTIdentifier()
  19. {
  20. return $this->getKey();
  21. }
  22. /**
  23. * Return a key value array, containing any custom claims to be added to the JWT.
  24. *
  25. * @return array
  26. */
  27. public function getJWTCustomClaims()
  28. {
  29. return [];
  30. }
  31. // protected $connection='mysql_dwbs';
  32. protected $table='admins';
  33. protected $guarded=[];
  34. protected $hidden=['password','mobile','created_at','deleted_at','updated_at','status'];
  35. public function role(){
  36. return $this->belongsTo(Role::class,'role_id');
  37. }
  38. }