Yii2 How izmeniti search generated using Gii which would have one field to search on all columns?

A CRUD app generated by Gii. The default for each column of your lookup field. Please tell me what should be changed in the model search to be able to using one field to search in all columns? Below is the function search generated by gii for the model search.

public function search($params) {

 $query = Clients::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,
 'status' => $this->status,
 'tel_mobile' => $this->tel_mobile,
 'tel_home' => $this->tel_home,
 'age' => $this->age,
 'call_time' => $this->call_time,
 'created_at' => $this->created_at,
]);

 $query->andFilterWhere(['like', 'fio', $this->fio])
 ->andFilterWhere(['like', 'address', $this->address])
 ->andFilterWhere(['like', 'comment', $this->comment]);

 return $dataProvider;
 }
September 19th 19 at 13:14
1 answer
September 19th 19 at 13:16
Solution
What to add
->orFilterWhere(['like', 'fio', $this->search])
->orFilterWhere(['like', 'address', $this->search])
->orFilterWhere(['like', 'comment', $this->search])

not roll?

Find more questions by tags CRUDPHP