public function actionIndex() { $data = Me::find()->all(); $searchModel = new MeSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'data' => $data]); }
public function search($params) { $query = Me::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'name' => $this->name, 'about' => $this->about]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'about', $this->about]); return $dataProvider; }