public function actionIndex() { if (!Yii::$app->getUser()->isGuest) { $itemRepository = new ItemRepository(); $tourRepository = new TourRepository(); $items = $itemRepository->getAllItemsData(); $tours = $tourRepository->getAllByNumber(); return $this->render('index', ['data' => $items, 'tours' => $tours]); } }
/** * Displays homepage. * * @return mixed */ public function actionIndex() { if (!Yii::$app->getUser()->isGuest) { $itemRepository = new ItemRepository(); $tourRepository = new TourRepository(); $items = $itemRepository->getAllItemsData(); $tours = $tourRepository->getAllByNumber(); return $this->render('index', ['data' => $items, 'tours' => $tours]); } else { Yii::$app->session->setFlash('error', 'Please log in to acces the website features.'); $this->redirect(BASE_URL . 'web/index.php/site/login'); } }