For this I wrote a function in the Gii generated User model which sets the 'status' field of the corresponding user table as follows
public function setStatus()
{
if (!\Yii::$app->user->isGuest) {
$this->status = 1;
}
else {
$this->status = 0;
}
}
Now in my Controller :
public function actionLogout()
{
$usr = new \frontend\models\User;
$usr->setStatus();
Yii::$app->user->logout();
return $this->goHome();
}
But Yii throws an error:
Cannot redeclare frontend\models\User::tableName();
I tried to echo all the autoloaded classes but the class is not autoloaded. How do I go about this?