/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = WebPhoto::find(); $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(['id' => $this->id, 'file_size' => $this->file_size, 'width' => $this->width, 'height' => $this->height, 'year' => $this->year, 'month' => $this->month, 'state' => $this->state, 'created_at' => $this->created_at, 'created_by' => $this->created_by, 'updated_at' => $this->updated_at, 'updated_by' => $this->updated_by]); $query->andFilterWhere(['like', 'guid', $this->guid])->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'alternative', $this->alternative])->andFilterWhere(['like', 'file_name', $this->file_name])->andFilterWhere(['like', 'file_type', $this->file_type]); return $dataProvider; }