public function actionIndex($id) { $user = User::findIdentity($id); $comments = Comment::getRecentComments(); $sidebarCategories = Category::getSidebarCategories(); $tags = Tag::getTagList(); return $this->render('index', ['user' => $user, 'comments' => $comments, 'sidebarCategories' => $sidebarCategories, 'tags' => $tags]); }
/** * Displays homepage. * * @return mixed */ public function actionIndex() { $query = Page::find()->where(['live' => 1]); $pagination = new Pagination(['defaultPageSize' => 2, 'totalCount' => $query->count()]); $pages = $query->offset($pagination->offset)->limit($pagination->limit)->all(); $comments = Comment::getRecentComments(); $sidebarCategories = Category::getSidebarCategories(); $tags = Tag::getTagList(); return $this->render('index', ['pages' => $pages, 'pagination' => $pagination, 'comments' => $comments, 'sidebarCategories' => $sidebarCategories, 'tags' => $tags]); }