예제 #1
0
 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]);
 }
예제 #2
0
 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;
 }