@@ -115,17 +115,17 @@ discard block |
||
115 | 115 | if (isset($criteria['search'])) { |
116 | 116 | foreach ($this->model->searchable as $method => $columns) { |
117 | 117 | if (method_exists($this->model, $method)) { |
118 | - $latest->orWhereHas($method, function ($query) use ($criteria, $columns) { |
|
118 | + $latest->orWhereHas($method, function($query) use ($criteria, $columns) { |
|
119 | 119 | /* @var $query Builder */ |
120 | - $query->where(function ($query2) use ($criteria, $columns) { |
|
120 | + $query->where(function($query2) use ($criteria, $columns) { |
|
121 | 121 | /* @var $query2 Builder */ |
122 | 122 | foreach ((array) $columns as $column) { |
123 | - $query2->orWhere($column, 'like', '%'.$criteria['search'].'%'); |
|
123 | + $query2->orWhere($column, 'like', '%' . $criteria['search'] . '%'); |
|
124 | 124 | } |
125 | 125 | }); |
126 | 126 | }); |
127 | 127 | } else { |
128 | - $latest->orWhere($columns, 'like', '%'.$criteria['search'].'%'); |
|
128 | + $latest->orWhere($columns, 'like', '%' . $criteria['search'] . '%'); |
|
129 | 129 | } |
130 | 130 | } |
131 | 131 | } |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | */ |
257 | 257 | public function find($entityId = 0, $columns = ['*']) |
258 | 258 | { |
259 | - if($this->allowCaching) |
|
259 | + if ($this->allowCaching) |
|
260 | 260 | { |
261 | 261 | if (isset($this->cache[$entityId])) |
262 | 262 | return $this->cache[$entityId]; |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | |
265 | 265 | $entity = $this->model->with($this->with)->find($entityId, $columns); |
266 | 266 | |
267 | - if($this->allowCaching) |
|
267 | + if ($this->allowCaching) |
|
268 | 268 | $this->cache[$entityId] = $entity; |
269 | 269 | |
270 | 270 | return $entity; |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | */ |
281 | 281 | public function findOrFail($entityId = 0, $columns = ['*']) |
282 | 282 | { |
283 | - if($this->allowCaching) |
|
283 | + if ($this->allowCaching) |
|
284 | 284 | { |
285 | 285 | if (isset($this->cache[$entityId])) |
286 | 286 | return $this->cache[$entityId]; |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | |
289 | 289 | $entity = $this->model->with($this->with)->findOrFail($entityId, $columns); |
290 | 290 | |
291 | - if($this->allowCaching) |
|
291 | + if ($this->allowCaching) |
|
292 | 292 | $this->cache[$entityId] = $entity; |
293 | 293 | |
294 | 294 | return $entity; |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | */ |
303 | 303 | public function first($filter = [], $columns = ['*']) |
304 | 304 | { |
305 | - if($this->allowCaching) |
|
305 | + if ($this->allowCaching) |
|
306 | 306 | { |
307 | 307 | if (isset($this->cache['first'])) |
308 | 308 | return $this->cache['first']; |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | |
311 | 311 | $entity = $this->model->with($this->with)->select($columns)->where($filter)->first(); |
312 | 312 | |
313 | - if($this->allowCaching) |
|
313 | + if ($this->allowCaching) |
|
314 | 314 | $this->cache['first'] = $entity; |
315 | 315 | |
316 | 316 | return $entity; |
@@ -324,16 +324,16 @@ discard block |
||
324 | 324 | */ |
325 | 325 | public function last($filter = [], $columns = ['*']) |
326 | 326 | { |
327 | - if($this->allowCaching) |
|
327 | + if ($this->allowCaching) |
|
328 | 328 | { |
329 | 329 | if (isset($this->cache['last'])) |
330 | 330 | return $this->cache['last']; |
331 | 331 | } |
332 | 332 | |
333 | 333 | $entity = $this->model->with($this->with)->select($columns)->where($filter) |
334 | - ->orderBy('id','desc')->first(); |
|
334 | + ->orderBy('id', 'desc')->first(); |
|
335 | 335 | |
336 | - if($this->allowCaching) |
|
336 | + if ($this->allowCaching) |
|
337 | 337 | $this->cache['last'] = $entity; |
338 | 338 | |
339 | 339 | return $entity; |