/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = SlideshowItem::find(); $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['device_type' => SORT_ASC, 'position' => SORT_ASC, 'id' => SORT_ASC]]]); $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, 'language_id' => $this->language_id, 'device_type' => $this->device_type, 'position' => $this->position, 'is_active' => $this->is_active, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]); $query->andFilterWhere(['like', 'image', $this->image])->andFilterWhere(['like', 'image_path', $this->image_path])->andFilterWhere(['like', 'link', $this->link])->andFilterWhere(['like', 'caption', $this->caption])->andFilterWhere(['like', 'created_by', $this->created_by])->andFilterWhere(['like', 'updated_by', $this->updated_by]); return $dataProvider; }