/** * Lists all Post models. * @return mixed */ public function actionIndex() { $dataProvider = new ActiveDataProvider(['query' => Post::find()->where(['type' => $this->type])]); return $this->render('index', ['dataProvider' => $dataProvider]); }
public function actionIndex() { $dataProvider = new ActiveDataProvider(['query' => Post::find()->where(['type' => 'post'])->orderBy('id DESC'), 'pagination' => ['pageSize' => 10]]); $this->view->title = 'News'; return $this->render('index', ['dataProvider' => $dataProvider]); }