12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <?php
- namespace App\Models;
- use Tymon\JWTAuth\Contracts\JWTSubject;
- use Illuminate\Notifications\Notifiable;
- use Illuminate\Database\Eloquent\SoftDeletes;
- use Illuminate\Foundation\Auth\User as Authuser;
- class Admin extends Authuser implements JWTSubject
- {
- use Notifiable;
- use SoftDeletes;
- protected $fillable = ['name','password','role_id','status','mobile'];
- protected $hidden = ['password'];
- // Rest omitted for brevity
- /**
- * Get the identifier that will be stored in the subject claim of the JWT.
- *
- * @return mixed
- */
- public function getJWTIdentifier()
- {
- return $this->getKey(); /*自己可以定义的生成token的参数,我用的是将主键加密*/
- }
- /**
- * Return a key value array, containing any custom claims to be added to the JWT.
- *
- * @return array
- */
- public function getJWTCustomClaims()
- {
- return [];
- }
- // public $timestamps = false;
- //定义表
- protected $table = "admins";
- //定义主键
- protected $primaryKey = "id";
- //获取管理员角色信息
- public function role()
- {
- //<<<<<<< HEAD
- return $this->hasOne('App\Models\Role','id','role_id');
- }
- //=======
- // return $this->hasOne('App\Role','id','role_id');
- // }
- //
- //
- //
- //>>>>>>> 9aa477479386789a8615d89285e74706ec72fbab
- }
|