Conditions | 2 |
Paths | 2 |
Total Lines | 45 |
Code Lines | 23 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
69 | public function search($params) |
||
70 | { |
||
71 | $query = Feedback::find(); |
||
72 | |||
73 | // add conditions that should always apply here |
||
74 | |||
75 | $dataProvider = new ActiveDataProvider([ |
||
76 | 'query' => $query, |
||
77 | ]); |
||
78 | |||
79 | $this->load($params); |
||
80 | |||
81 | if (!$this->validate()) { |
||
82 | // uncomment the following line if you do not want to return any records when validation fails |
||
83 | // $query->where('0=1'); |
||
84 | return $dataProvider; |
||
85 | } |
||
86 | |||
87 | // grid filtering conditions |
||
88 | $query->andFilterWhere([ |
||
89 | 'read' => $this->read, |
||
90 | 'email' => $this->email, |
||
91 | 'phone' => $this->phone, |
||
92 | ]); |
||
93 | |||
94 | $query->andFilterWhere([ |
||
95 | 'like', |
||
96 | 'name', |
||
97 | $this->name |
||
98 | ]); |
||
99 | |||
100 | $query->andFilterWhere([ |
||
101 | 'like', |
||
102 | 'subject', |
||
103 | $this->subject |
||
104 | ]); |
||
105 | |||
106 | $pagination = new Pagination([ |
||
107 | 'defaultPageSize' => 20, |
||
108 | 'totalCount' => $query->count(), |
||
109 | ]); |
||
110 | |||
111 | $dataProvider->setPagination($pagination); |
||
112 | |||
113 | return $dataProvider; |
||
114 | } |
||
124 |