@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | */ |
| 239 | 239 | protected function assumeForeignKey($related): string |
| 240 | 240 | { |
| 241 | - return Str::snake((new $related())->getResponseKey()).'_id'; |
|
| 241 | + return Str::snake((new $related())->getResponseKey()) . '_id'; |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | /** |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | */ |
| 380 | 380 | public function getOrderByDirectionParameter(): string |
| 381 | 381 | { |
| 382 | - return $this->orderByDirectionParameter ?? $this->getOrderByParameter().'desc'; |
|
| 382 | + return $this->orderByDirectionParameter ?? $this->getOrderByParameter() . 'desc'; |
|
| 383 | 383 | } |
| 384 | 384 | |
| 385 | 385 | /** |
@@ -407,22 +407,22 @@ discard block |
||
| 407 | 407 | // If have an id, then put it on the end |
| 408 | 408 | // NOTE: Halo treats creates & updates the same, so only on existing |
| 409 | 409 | if ($this->exist && $this->getKey()) { |
| 410 | - $path .= '/'.$this->getKey(); |
|
| 410 | + $path .= '/' . $this->getKey(); |
|
| 411 | 411 | } |
| 412 | 412 | |
| 413 | 413 | // Stick any extra things on the end |
| 414 | - if (! is_null($extra)) { |
|
| 415 | - $path .= '/'.ltrim($extra, '/'); |
|
| 414 | + if (!is_null($extra)) { |
|
| 415 | + $path .= '/' . ltrim($extra, '/'); |
|
| 416 | 416 | } |
| 417 | 417 | |
| 418 | - if (! empty($query = $this->getDefaultWheres($query))) { |
|
| 418 | + if (!empty($query = $this->getDefaultWheres($query))) { |
|
| 419 | 419 | // NOTE: Halo does not accept the index in array of properties, so removing them |
| 420 | 420 | // ?priority%5B0%5D=4&priority%5B1%5D=3 becomes priority=4&priority=3 |
| 421 | - $path .= '?'.preg_replace('/%5B\d+%5D=/', '=', http_build_query($this->convertBoolToString($query))); |
|
| 421 | + $path .= '?' . preg_replace('/%5B\d+%5D=/', '=', http_build_query($this->convertBoolToString($query))); |
|
| 422 | 422 | } |
| 423 | 423 | |
| 424 | 424 | // If there is a parentModel & not have an id (unless for nested), then prepend parentModel |
| 425 | - if (! is_null($this->parentModel) && (! $this->getKey() || $this->isNested())) { |
|
| 425 | + if (!is_null($this->parentModel) && (!$this->getKey() || $this->isNested())) { |
|
| 426 | 426 | return $this->parentModel->getPath($path); |
| 427 | 427 | } |
| 428 | 428 | |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | { |
| 441 | 441 | $relation = $this->{$method}(); |
| 442 | 442 | |
| 443 | - if (! $relation instanceof Relation) { |
|
| 443 | + if (!$relation instanceof Relation) { |
|
| 444 | 444 | $exception_message = is_null($relation) |
| 445 | 445 | ? '%s::%s must return a relationship instance, but "null" was returned. Was the "return" keyword used?' |
| 446 | 446 | : '%s::%s must return a relationship instance.'; |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | |
| 453 | 453 | return tap( |
| 454 | 454 | $relation->getResults(), |
| 455 | - function ($results) use ($method) { |
|
| 455 | + function($results) use ($method) { |
|
| 456 | 456 | $this->setRelation($method, $results); |
| 457 | 457 | } |
| 458 | 458 | ); |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | $model = (new $related([], $this->parentModel))->setClient($this->getClient()); |
| 494 | 494 | |
| 495 | 495 | return (new Collection($given))->map( |
| 496 | - function ($attributes) use ($model, $reset) { |
|
| 496 | + function($attributes) use ($model, $reset) { |
|
| 497 | 497 | return $model->newFromBuilder($reset ? reset($attributes) : $attributes); |
| 498 | 498 | } |
| 499 | 499 | ); |
@@ -601,7 +601,7 @@ discard block |
||
| 601 | 601 | */ |
| 602 | 602 | public function offsetExists($offset): bool |
| 603 | 603 | { |
| 604 | - return ! is_null($this->getAttribute($offset)); |
|
| 604 | + return !is_null($this->getAttribute($offset)); |
|
| 605 | 605 | } |
| 606 | 606 | |
| 607 | 607 | /** |
@@ -681,7 +681,7 @@ discard block |
||
| 681 | 681 | } |
| 682 | 682 | |
| 683 | 683 | try { |
| 684 | - if (! $this->isDirty()) { |
|
| 684 | + if (!$this->isDirty()) { |
|
| 685 | 685 | return true; |
| 686 | 686 | } |
| 687 | 687 | |
@@ -712,7 +712,7 @@ discard block |
||
| 712 | 712 | */ |
| 713 | 713 | public function saveOrFail(): bool |
| 714 | 714 | { |
| 715 | - if (! $this->save()) { |
|
| 715 | + if (!$this->save()) { |
|
| 716 | 716 | throw new UnableToSaveException(); |
| 717 | 717 | } |
| 718 | 718 | |