getKey(); /*自己可以定义的生成token的参数,我用的是将主键加密*/ } /** * Return a key value array, containing any custom claims to be added to the JWT. * * @return array */ public function getJWTCustomClaims() { return []; } //定义表 protected $table = "roles"; //定义主键 protected $primaryKey = "id"; /** * 获得拥有此角色的管理员。 */ public function admin() { return $this->belongsTo('App\Admin','id','role_id'); } }