/**
* Displays homepage.
*
- * @return string
+ * @return string|Response
*/
public function actionIndex()
{
- return $this->render('index');
+ $session = Yii::$app->session;
+ if (isset($session['view_modules'])) {
+ return $this->render('index');
+ } else {
+ // если нет нужных данных, удаляем сессию и отправляем на главную
+ $session->destroy();
+ return $this->goHome();
+ }
}
/**
return $this->render('about');
}
- public function actionMenuTree() {
+ public function actionMenuTree()
+ {
// $client = new Client(['base_uri' => Yii::$app->params['API2_URL']]);
// $response = $client->request('GET', '/site/menu-tree?user_id=' . Yii::$app->user->id . '&key=' . Yii::$app->params['API2_TOKEN']);
// return $this->asJson(json_decode($response->getBody(), true));