$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([ 'id' => $this->id, 'sort_delete' => $this->sort_delete, 'is_active' => $this->is_active, 'mail_send' => $this->mail_send, 'mails_count' => $this->mails_count, ]); if( !empty( $this->dt ) || !empty( $this->date_to ) ){ $date_from = \Yii::$app->converter->convertTo( 'timestamp', $this->dt ); $date_to = \Yii::$app->converter->convertTo( 'timestamp', $this->date_to, ['begin_of_the_day' => false] ); $query->andFilterWhere([ 'between', 'dt', $date_from, $date_to ]); } $query->andFilterWhere(['like', 'name', $this->name]) ->andFilterWhere(['like', 'code', $this->code]) ->andFilterWhere(['like', 'brief', $this->brief]) ->andFilterWhere(['like', 'content', $this->content]) ->andFilterWhere(['like', 'title', $this->title]) ->andFilterWhere(['like', 'kwords', $this->kwords]) ->andFilterWhere(['like', 'descr', $this->descr]) ->andFilterWhere(['like', 'img', $this->img]); return $dataProvider; } }