[ 'class' => AccessControl::className(), 'rules' => [ [ 'allow' => true, 'roles' => ['@'], ], ], ], ]; } public function actionIndex() { $this->view->registerJs(' var wsURL = "' . Yii::$app->params['wsURL'] . '/?type=user&id=' . Yii::$app->user->identity->id . '&auth_token=' . Yii::$app->user->identity->getAuthToken() . '"; ', View::POS_HEAD); $roomModels = Room::find()->all(); return $this->render('index', [ 'roomModels' => $roomModels, ]); } }