getKey(); } /** * Return a key value array, containing any custom claims to be added to the JWT. * * @return array */ public function getJWTCustomClaims() { return []; } protected $table = 'users'; /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'name', 'password' ]; /** * The attributes that should be hidden for arrays. * * @var array */ protected $hidden = [ 'password' ]; //将密码进行加密 public function setPasswordAttribute($value) { $this->attributes['password'] = bcrypt($value); } public function books(){ return $this->hasMany(Book::class,'user_id','id')->limit(2); } }