/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Category::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'root' => $this->root, 'lft' => $this->lft, 'rgt' => $this->rgt, 'lvl' => $this->lvl, 'icon_type' => $this->icon_type, 'active' => $this->active, 'selected' => $this->selected, 'disabled' => $this->disabled, 'readonly' => $this->readonly, 'visible' => $this->visible, 'collapsed' => $this->collapsed, 'movable_u' => $this->movable_u, 'movable_d' => $this->movable_d, 'movable_l' => $this->movable_l, 'movable_r' => $this->movable_r, 'removable' => $this->removable, 'removable_all' => $this->removable_all]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'icon', $this->icon]); return $dataProvider; }