After login from frontend in yii2 I want, page should redirect to backend index page.
public function actionLogin()
{
if (!Yii::$app->user->isGuest) {
return $this-> render('commercial');
}
$model = new LoginForm();
if ($model->load(Yii::$app->request->post()) && $model->login()) {
$this->layout = 'noBar';
return $this-> render('home'); //backend/index should be open
} else {
return $this->render('login', [
'model' => $model,
]);
}
}
I have tried in many ways (like Url manager n all) but did not get the required result?