public function actionBlog() { $countPostOnPage = SetupSite::getParam('countPostOnPage'); $data = $this->getCommonDate(); $modelGoodsCategories = GoodsCategory::find()->all(); $modelBanner = Banner::find()->where(['status' => 0])->all(); $modelBrends = Brend::find()->all(); $modelBlog = Blog::find(); $countQuery = clone $modelBlog; $pages = new Pagination(['totalCount' => $countQuery->count(), 'defaultPageSize' => 3]); $models = $modelBlog->offset($pages->offset)->limit($countPostOnPage)->orderBy('created_at DESC')->all(); return $this->render('blog', ['models' => $models, 'pages' => $pages, 'data' => $data, 'modelGoodsCategories' => $modelGoodsCategories, 'modelBrends' => $modelBrends, 'modelBanner' => $modelBanner]); }