user->generateAccessToken(); $this->user->access_token_expired_at = date('Y-m-d', time() + static::EXPIRE_TIME); $this->user->save(false); Yii::$app->user->login($this->user, static::EXPIRE_TIME); return $access_token; } /** * @return ActiveQuery */ public function getUser() { return $this->hasOne(User::class, ['id' => 'user_id']); } }