orderBy('sequence DESC'); $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([ 'carouselid' => $this->carouselid, 'sequence' => $this->sequence, 'createdwhen' => $this->createdwhen, ]); $query->andFilterWhere(['like', 'imageurl', $this->imageurl]) ->andFilterWhere(['like', 'caption', $this->caption]) ->andFilterWhere(['like', 'query', $this->query]) ->andFilterWhere(['like', 'createdby', $this->createdby]); return $dataProvider; } }