@@ -47,9 +47,11 @@ discard block |
||
47 | 47 | |
48 | 48 | return \DB::getQueryLog(); |
49 | 49 | |
50 | - else: |
|
50 | + else { |
|
51 | + : |
|
51 | 52 | |
52 | 53 | return $result; |
54 | + } |
|
53 | 55 | |
54 | 56 | endif; |
55 | 57 | } |
@@ -67,14 +69,18 @@ discard block |
||
67 | 69 | |
68 | 70 | private function __queryCustom() |
69 | 71 | { |
70 | - if(!isset($this->custom)) return; |
|
72 | + if(!isset($this->custom)) { |
|
73 | + return; |
|
74 | + } |
|
71 | 75 | |
72 | 76 | $this->query->where($this->custom); |
73 | 77 | } |
74 | 78 | |
75 | 79 | private function __querySearch() |
76 | 80 | { |
77 | - if(!isset(self::$searchables)) return; |
|
81 | + if(!isset(self::$searchables)) { |
|
82 | + return; |
|
83 | + } |
|
78 | 84 | |
79 | 85 | $this->query->where( function($query) |
80 | 86 | { |
@@ -88,8 +94,10 @@ discard block |
||
88 | 94 | { |
89 | 95 | $query->where($_searchable[1],'LIKE','%'.$this->search.'%'); |
90 | 96 | }); |
91 | - else: |
|
92 | - $query->orWhere($searchable,'LIKE','%'.$this->search.'%'); |
|
97 | + else { |
|
98 | + : |
|
99 | + $query->orWhere($searchable,'LIKE','%'.$this->search.'%'); |
|
100 | + } |
|
93 | 101 | endif; |
94 | 102 | |
95 | 103 | endforeach; |
@@ -98,7 +106,9 @@ discard block |
||
98 | 106 | |
99 | 107 | private function __queryFilter() |
100 | 108 | { |
101 | - if(!isset(self::$filterables)) return; |
|
109 | + if(!isset(self::$filterables)) { |
|
110 | + return; |
|
111 | + } |
|
102 | 112 | |
103 | 113 | $this->query->where(function($query) |
104 | 114 | { |
@@ -123,9 +133,11 @@ discard block |
||
123 | 133 | $query->whereNotIn($relationship[1],$values); |
124 | 134 | }); |
125 | 135 | |
126 | - else: |
|
136 | + else { |
|
137 | + : |
|
127 | 138 | |
128 | 139 | $values = explode(',',$value); |
140 | + } |
|
129 | 141 | |
130 | 142 | $query->with($relationship[0])->whereHas($relationship[0],function($query) use ( $relationship, $values, $value) |
131 | 143 | { |
@@ -134,19 +146,23 @@ discard block |
||
134 | 146 | |
135 | 147 | endif; |
136 | 148 | |
137 | - else: |
|
149 | + else { |
|
150 | + : |
|
138 | 151 | if($value[0]=='!'): |
139 | 152 | |
140 | 153 | $values = explode(',',substr($value,1)); |
154 | + } |
|
141 | 155 | |
142 | 156 | $query->where(function($query) use ($attribute, $values) |
143 | 157 | { |
144 | 158 | $query->whereNotIn($attribute,$values); |
145 | 159 | }); |
146 | 160 | |
147 | - else: |
|
161 | + else { |
|
162 | + : |
|
148 | 163 | |
149 | 164 | $values = explode(',',$value); |
165 | + } |
|
150 | 166 | |
151 | 167 | count($values) > 1 ? $query->whereIn($attribute,$values) : $query->where($attribute,$value); |
152 | 168 | |
@@ -162,7 +178,9 @@ discard block |
||
162 | 178 | |
163 | 179 | private function __queryRange() |
164 | 180 | { |
165 | - if(!isset(self::$rangables)) return; |
|
181 | + if(!isset(self::$rangables)) { |
|
182 | + return; |
|
183 | + } |
|
166 | 184 | |
167 | 185 | $this->query->where(function($query) |
168 | 186 | { |
@@ -183,9 +201,11 @@ discard block |
||
183 | 201 | $query->whereNotBetween($relationship[1],$values); |
184 | 202 | }); |
185 | 203 | |
186 | - else: |
|
204 | + else { |
|
205 | + : |
|
187 | 206 | |
188 | 207 | $values = explode(',',$value); |
208 | + } |
|
189 | 209 | |
190 | 210 | $query->with($relationship[0])->whereHas($relationship[0],function($query) use ( $relationship, $values, $value) |
191 | 211 | { |
@@ -194,20 +214,24 @@ discard block |
||
194 | 214 | |
195 | 215 | endif; |
196 | 216 | |
197 | - else: |
|
217 | + else { |
|
218 | + : |
|
198 | 219 | |
199 | 220 | if($value[0]=='!'): |
200 | 221 | |
201 | 222 | $values = explode(',',substr($value,1)); |
223 | + } |
|
202 | 224 | |
203 | 225 | $query->where(function($q) use ($attribute, $values) |
204 | 226 | { |
205 | 227 | $q->whereNotBetween($attribute,$values); |
206 | 228 | }); |
207 | 229 | |
208 | - else: |
|
230 | + else { |
|
231 | + : |
|
209 | 232 | |
210 | 233 | $values = explode(',',$value); |
234 | + } |
|
211 | 235 | |
212 | 236 | $query->whereBetween($attribute,$values); |
213 | 237 | |
@@ -223,7 +247,9 @@ discard block |
||
223 | 247 | |
224 | 248 | private function __queryOrder() |
225 | 249 | { |
226 | - if(!isset(self::$orderables)) return; |
|
250 | + if(!isset(self::$orderables)) { |
|
251 | + return; |
|
252 | + } |
|
227 | 253 | |
228 | 254 | foreach($this->order ?: [] as $attribute => $value): |
229 | 255 | |
@@ -238,9 +264,11 @@ discard block |
||
238 | 264 | $query->orderBy($relationship[1],$value); |
239 | 265 | }]); |
240 | 266 | |
241 | - else: |
|
267 | + else { |
|
268 | + : |
|
242 | 269 | |
243 | 270 | $this->query->orderBy($attribute, $value); |
271 | + } |
|
244 | 272 | |
245 | 273 | endif; |
246 | 274 |