belongsToMany(Game::class, 'game_users', 'user_id', 'game_id '); } public function teams() { return $this->belongsToMany(Team::class, 'team_users', 'user_id', 'team_id '); } public function user_extra(){ return $this->hasOne(UserExtra::class,'user_id','id'); } public function getJWTIdentifier() { return $this->getKey(); // TODO: Implement getJWTIdentifier() method. } public function getJWTCustomClaims() { return [ 'role' => 'user' ]; // TODO: Implement getJWTCustomClaims() method. } /** * 设置密码加密 * @param $value * @return string */ public function setPasswordAttribute($value) { $this->attributes['password'] = bcrypt($value); } }