/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Permission::find()->andWhere(['category' => $params['category']]); $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(['form' => $this->form, 'sort_num' => $this->sort_num]); $query->andFilterWhere(['like', 'id', $this->id])->andFilterWhere(['like', 'category', $this->category])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'options', $this->options])->andFilterWhere(['like', 'default_value', $this->default_value])->andFilterWhere(['like', 'rule', $this->rule]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Permission::find(); $query->orderBy('id asc,sort_num desc'); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); $this->category_id = LuLu::getGetValue('category'); $query->andWhere(['category_id' => $this->category_id]); if (!$this->validate()) { // uncomment the following line if you do not want to any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['category_id' => $this->category_id, 'form' => $this->form]); $query->andFilterWhere(['like', 'id', $this->id])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'description', $this->description]); return $dataProvider; }