/** * Display articles. * * @return mixed */ public function actionArticles() { $searchModel = new ArticlesSearch(); //Работает только для статей с Articles::find()->where(['publish_status' => 'publish']) $dataProvider = $searchModel->search(Yii::$app->request->queryParams); $dataProvider->pagination = ['PageSize' => 2]; return $this->render('articles', ['dataProvider' => $dataProvider, 'searchModel' => $searchModel]); }
/** * Lists all Articles models. * @return mixed */ public function actionIndex() { $searchModel = new ArticlesSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); }