예제 #1
0
 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]);
     }
 }
예제 #2
0
 /**
  * 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');
     }
 }