$query, 'sort' =>[ 'defaultOrder' =>[ 'created_at' => SORT_DESC ] ] ]); $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_newsletter' => $this->id_newsletter, 'status' => $this->status, 'sent' => $this->sent, 'sent_at' => $this->sent_at, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, ]); $query->andFilterWhere(['like', 'subject', $this->subject]) ->andFilterWhere(['like', 'body', $this->body]); return $dataProvider; } }