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