Admin.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 DateTimeInterface;
  7. use Illuminate\Foundation\Auth\User as Authenticatable;
  8. class Admin extends Authenticatable implements JWTSubject
  9. {
  10. use Notifiable;
  11. use SoftDeletes;
  12. protected $table='admins';
  13. protected $hidden=['password'];
  14. protected function serializeDate(DateTimeInterface $date)
  15. {
  16. return $date->format('Y-m-d H:i:s');
  17. }
  18. // Rest omitted for brevity
  19. /**
  20. * Get the identifier that will be stored in the subject claim of the JWT.
  21. *
  22. * @return mixed
  23. */
  24. public function getJWTIdentifier()
  25. {
  26. return $this->getKey();
  27. }
  28. /**
  29. * Return a key value array, containing any custom claims to be added to the JWT.
  30. *
  31. * @return array
  32. */
  33. public function getJWTCustomClaims()
  34. {
  35. return [];
  36. }
  37. public function role(){
  38. return $this->hasOne('App\Models\Role','id','role_id');
  39. }
  40. }