Answer the question
In order to leave comments, you need to log in
How to update the user field when he logs in?
How to make a similarity update_at
, but with its own field and value? Without making crutches, increasing with the same code in controllers and models.
According to the idea, it’s logical to somehow competently add your field in the same update_at
way without making additional queries to the database, but I would not want to change the Yii2 advanced basic models.
UserController:
public function actionLogin()
{
$this->layout = 'login';
if (!Yii::$app->user->isGuest) {
return $this->goHome();
}
$model = new LoginForm();
if ($model->load(Yii::$app->request->post()) && $model->login()) {
return $this->goHome();
} else {
$model->password = '';
return $this->render('login', [
'model' => $model,
]);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question