コード例 #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
ファイル: MeSearch.php プロジェクト: aversilov/singree-bboard
 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;
 }