/** * Lists all Country models. * @return mixed */ public function actionIndex() { $model = new Country(); if ($model->load(\Yii::$app->request->post()) && $model->save()) { $model = new Country(); //reset model } $searchModel = new CountrySearch(); $dataProvider = $searchModel->search(\Yii::$app->request->queryParams); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'model' => $model]); }
public function prepareDataProvider() { $model = new CountrySearch(); return $model->search(Yii::$app->request->queryParams); }