@@ -92,7 +92,7 @@ |
||
| 92 | 92 | * |
| 93 | 93 | * @return LengthAwarePaginator |
| 94 | 94 | */ |
| 95 | - public function get($criteria = [],$columns = []); |
|
| 95 | + public function get($criteria = [], $columns = []); |
|
| 96 | 96 | |
| 97 | 97 | /** |
| 98 | 98 | * @param string $name |
@@ -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 | } |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | * @param array $columns |
| 182 | 182 | * @return Builder[]|Collection |
| 183 | 183 | */ |
| 184 | - public function get($criteria = [],$columns = []) |
|
| 184 | + public function get($criteria = [], $columns = []) |
|
| 185 | 185 | { |
| 186 | 186 | return $this->filter($criteria)->get($columns); |
| 187 | 187 | } |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | */ |
| 248 | 248 | public function find($entityId = 0, $columns = ['*']) |
| 249 | 249 | { |
| 250 | - if($this->allowCaching) |
|
| 250 | + if ($this->allowCaching) |
|
| 251 | 251 | { |
| 252 | 252 | if (isset($this->cache[$entityId])) |
| 253 | 253 | return $this->cache[$entityId]; |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | |
| 256 | 256 | $entity = $this->model->with($this->with)->find($entityId, $columns); |
| 257 | 257 | |
| 258 | - if($this->allowCaching) |
|
| 258 | + if ($this->allowCaching) |
|
| 259 | 259 | $this->cache[$entityId] = $entity; |
| 260 | 260 | |
| 261 | 261 | return $entity; |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | */ |
| 272 | 272 | public function findOrFail($entityId = 0, $columns = ['*']) |
| 273 | 273 | { |
| 274 | - if($this->allowCaching) |
|
| 274 | + if ($this->allowCaching) |
|
| 275 | 275 | { |
| 276 | 276 | if (isset($this->cache[$entityId])) |
| 277 | 277 | return $this->cache[$entityId]; |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | |
| 280 | 280 | $entity = $this->model->with($this->with)->findOrFail($entityId, $columns); |
| 281 | 281 | |
| 282 | - if($this->allowCaching) |
|
| 282 | + if ($this->allowCaching) |
|
| 283 | 283 | $this->cache[$entityId] = $entity; |
| 284 | 284 | |
| 285 | 285 | return $entity; |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | */ |
| 294 | 294 | public function first($filter = [], $columns = ['*']) |
| 295 | 295 | { |
| 296 | - if($this->allowCaching) |
|
| 296 | + if ($this->allowCaching) |
|
| 297 | 297 | { |
| 298 | 298 | if (isset($this->cache['first'])) |
| 299 | 299 | return $this->cache['first']; |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | |
| 302 | 302 | $entity = $this->model->with($this->with)->select($columns)->where($filter)->first(); |
| 303 | 303 | |
| 304 | - if($this->allowCaching) |
|
| 304 | + if ($this->allowCaching) |
|
| 305 | 305 | $this->cache['first'] = $entity; |
| 306 | 306 | |
| 307 | 307 | return $entity; |
@@ -315,16 +315,16 @@ discard block |
||
| 315 | 315 | */ |
| 316 | 316 | public function last($filter = [], $columns = ['*']) |
| 317 | 317 | { |
| 318 | - if($this->allowCaching) |
|
| 318 | + if ($this->allowCaching) |
|
| 319 | 319 | { |
| 320 | 320 | if (isset($this->cache['last'])) |
| 321 | 321 | return $this->cache['last']; |
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | $entity = $this->model->with($this->with)->select($columns)->where($filter) |
| 325 | - ->orderBy('id','desc')->first(); |
|
| 325 | + ->orderBy('id', 'desc')->first(); |
|
| 326 | 326 | |
| 327 | - if($this->allowCaching) |
|
| 327 | + if ($this->allowCaching) |
|
| 328 | 328 | $this->cache['last'] = $entity; |
| 329 | 329 | |
| 330 | 330 | return $entity; |