Beispiel #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Comment::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'content_id' => $this->content_id, 'user_id' => $this->user_id, 'created_at' => $this->created_at, 'status' => $this->status]);
     $query->andFilterWhere(['like', 'reply_ids', $this->reply_ids])->andFilterWhere(['like', 'user_name', $this->user_name])->andFilterWhere(['like', 'user_email', $this->user_email])->andFilterWhere(['like', 'user_url', $this->user_url])->andFilterWhere(['like', 'user_ip', $this->user_ip])->andFilterWhere(['like', 'user_address', $this->user_address])->andFilterWhere(['like', 'content', $this->content]);
     return $dataProvider;
 }