$query, 'sort' => [ 'defaultOrder'=>[ 'id'=> SORT_DESC ], ], 'pagination'=>[ 'pageSize' => 6, ], ]); $this->load($params,$formName); 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->joinWith('category'); // grid filtering conditions $query->andFilterWhere([ 'id' => $this->id, 'cat_id' => $this->cat_id, ]); $query->andFilterWhere(['like', 'title', $this->title]) ->andFilterWhere(['like', 'text', $this->text]) ->andFilterWhere(['like', 'picture', $this->picture]) ->andFilterWhere(['like', 'posts.description', $this->description]) ->andFilterWhere(['like', 'key_words', $this->key_words]) ->andFilterWhere(['like', 'categoriesblog.slug', $this->categorySlug]); return $dataProvider; } }