We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -100,11 +100,11 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function setModel($model_namespace) |
102 | 102 | { |
103 | - if (! class_exists($model_namespace)) { |
|
103 | + if (!class_exists($model_namespace)) { |
|
104 | 104 | throw new \Exception('The model does not exist.', 500); |
105 | 105 | } |
106 | 106 | |
107 | - if (! method_exists($model_namespace, 'hasCrudTrait')) { |
|
107 | + if (!method_exists($model_namespace, 'hasCrudTrait')) { |
|
108 | 108 | throw new \Exception('Please use CrudTrait on the model.', 500); |
109 | 109 | } |
110 | 110 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | { |
168 | 168 | $complete_route = $route.'.index'; |
169 | 169 | |
170 | - if (! \Route::has($complete_route)) { |
|
170 | + if (!\Route::has($complete_route)) { |
|
171 | 171 | throw new \Exception('There are no routes for this route name.', 404); |
172 | 172 | } |
173 | 173 | |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | */ |
269 | 269 | public function getFirstOfItsTypeInArray($type, $array) |
270 | 270 | { |
271 | - return Arr::first($array, function ($item) use ($type) { |
|
271 | + return Arr::first($array, function($item) use ($type) { |
|
272 | 272 | return $item['type'] == $type; |
273 | 273 | }); |
274 | 274 | } |
@@ -285,8 +285,8 @@ discard block |
||
285 | 285 | |
286 | 286 | public function sync($type, $fields, $attributes) |
287 | 287 | { |
288 | - if (! empty($this->{$type})) { |
|
289 | - $this->{$type} = array_map(function ($field) use ($fields, $attributes) { |
|
288 | + if (!empty($this->{$type})) { |
|
289 | + $this->{$type} = array_map(function($field) use ($fields, $attributes) { |
|
290 | 290 | if (in_array($field['name'], (array) $fields)) { |
291 | 291 | $field = array_merge($field, $attributes); |
292 | 292 | } |
@@ -317,15 +317,15 @@ discard block |
||
317 | 317 | { |
318 | 318 | $relationArray = explode('.', $relationString); |
319 | 319 | |
320 | - if (! isset($length)) { |
|
320 | + if (!isset($length)) { |
|
321 | 321 | $length = count($relationArray); |
322 | 322 | } |
323 | 323 | |
324 | - if (! isset($model)) { |
|
324 | + if (!isset($model)) { |
|
325 | 325 | $model = $this->model; |
326 | 326 | } |
327 | 327 | |
328 | - $result = array_reduce(array_splice($relationArray, 0, $length), function ($obj, $method) { |
|
328 | + $result = array_reduce(array_splice($relationArray, 0, $length), function($obj, $method) { |
|
329 | 329 | try { |
330 | 330 | $result = $obj->$method(); |
331 | 331 | |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | if (is_array($entries)) { |
362 | 362 | //if attribute does not exist in main array we have more than one entry OR the attribute |
363 | 363 | //is an acessor that is not in $appends property of model. |
364 | - if (! isset($entries[$attribute])) { |
|
364 | + if (!isset($entries[$attribute])) { |
|
365 | 365 | //we first check if we don't have the attribute because it's and acessor that is not in appends. |
366 | 366 | if ($model_instance->hasGetMutator($attribute) && isset($entries[$modelKey])) { |
367 | 367 | $entry_in_database = $model_instance->find($entries[$modelKey]); |
@@ -401,21 +401,21 @@ discard block |
||
401 | 401 | */ |
402 | 402 | public function parseTranslatableAttributes($model, $attribute, $value) |
403 | 403 | { |
404 | - if (! method_exists($model, 'isTranslatableAttribute')) { |
|
404 | + if (!method_exists($model, 'isTranslatableAttribute')) { |
|
405 | 405 | return $value; |
406 | 406 | } |
407 | 407 | |
408 | - if (! $model->isTranslatableAttribute($attribute)) { |
|
408 | + if (!$model->isTranslatableAttribute($attribute)) { |
|
409 | 409 | return $value; |
410 | 410 | } |
411 | 411 | |
412 | - if (! is_array($value)) { |
|
412 | + if (!is_array($value)) { |
|
413 | 413 | $decodedAttribute = json_decode($value, true); |
414 | 414 | } else { |
415 | 415 | $decodedAttribute = $value; |
416 | 416 | } |
417 | 417 | |
418 | - if (is_array($decodedAttribute) && ! empty($decodedAttribute)) { |
|
418 | + if (is_array($decodedAttribute) && !empty($decodedAttribute)) { |
|
419 | 419 | if (isset($decodedAttribute[app()->getLocale()])) { |
420 | 420 | return $decodedAttribute[app()->getLocale()]; |
421 | 421 | } else { |
@@ -443,21 +443,21 @@ discard block |
||
443 | 443 | $currentResults = []; |
444 | 444 | |
445 | 445 | $results = []; |
446 | - if (! is_null($relation)) { |
|
447 | - if ($relation instanceof Collection && ! $relation->isEmpty()) { |
|
446 | + if (!is_null($relation)) { |
|
447 | + if ($relation instanceof Collection && !$relation->isEmpty()) { |
|
448 | 448 | $currentResults[get_class($relation->first())] = $relation->toArray(); |
449 | - } elseif (is_array($relation) && ! empty($relation)) { |
|
449 | + } elseif (is_array($relation) && !empty($relation)) { |
|
450 | 450 | $currentResults[get_class($relation->first())] = $relation; |
451 | 451 | } else { |
452 | 452 | //relation must be App\Models\Article or App\Models\Category |
453 | - if (! $relation instanceof Collection && ! empty($relation)) { |
|
453 | + if (!$relation instanceof Collection && !empty($relation)) { |
|
454 | 454 | $currentResults[get_class($relation)] = $relation->toArray(); |
455 | 455 | } |
456 | 456 | } |
457 | 457 | |
458 | 458 | array_shift($relationArray); |
459 | 459 | |
460 | - if (! empty($relationArray)) { |
|
460 | + if (!empty($relationArray)) { |
|
461 | 461 | foreach ($currentResults as $model => $currentResult) { |
462 | 462 | $results[$model] = array_merge($results[$model], $this->getRelatedEntries($currentResult, implode('.', $relationArray))); |
463 | 463 | } |