@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | if ($position === 0) { |
| 25 | 25 | $foreignKeys[] = $this->ownerKey; |
| 26 | 26 | |
| 27 | - $localKeys[] = function (Builder $query, Builder $parentQuery = null) { |
|
| 27 | + $localKeys[] = function(Builder $query, Builder $parentQuery = null) { |
|
| 28 | 28 | if ($parentQuery) { |
| 29 | 29 | $this->getRelationExistenceQuery($this->query, $parentQuery); |
| 30 | 30 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | $this->mergeWhereConstraints($query, $this->query); |
| 33 | 33 | }; |
| 34 | 34 | } else { |
| 35 | - $foreignKeys[] = function (Builder $query, JoinClause $join) { |
|
| 35 | + $foreignKeys[] = function(Builder $query, JoinClause $join) { |
|
| 36 | 36 | $ownerKey = $this->query->qualifyColumn($this->ownerKey); |
| 37 | 37 | |
| 38 | 38 | [$sql, $bindings] = $this->relationExistenceQueryOwnerKey($query, $ownerKey); |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | public function appendToDeepRelationship(array $through, array $foreignKeys, array $localKeys, int $position): array |
| 26 | 26 | { |
| 27 | 27 | if ($position === 0) { |
| 28 | - $foreignKeys[] = function (Builder $query, Builder $parentQuery = null) { |
|
| 28 | + $foreignKeys[] = function(Builder $query, Builder $parentQuery = null) { |
|
| 29 | 29 | if ($parentQuery) { |
| 30 | 30 | $this->getRelationExistenceQuery($this->query, $parentQuery); |
| 31 | 31 | } |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | $localKeys[] = $this->localKey; |
| 37 | 37 | } else { |
| 38 | - $foreignKeys[] = function (Builder $query, JoinClause $join) { |
|
| 38 | + $foreignKeys[] = function(Builder $query, JoinClause $join) { |
|
| 39 | 39 | [$sql, $bindings] = $this->relationExistenceQueryParentKey($query); |
| 40 | 40 | |
| 41 | 41 | $query->addBinding($bindings, 'join'); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | { |
| 79 | 79 | $parentKeys = $this->getKeys($models, $this->localKey); |
| 80 | 80 | |
| 81 | - $this->query->where(function (Builder $query) use ($parentKeys) { |
|
| 81 | + $this->query->where(function(Builder $query) use ($parentKeys) { |
|
| 82 | 82 | foreach ($parentKeys as $parentKey) { |
| 83 | 83 | if ($this->key) { |
| 84 | 84 | $parentKey = $this->parentKeyToArray($parentKey); |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | $key = str_replace('->', '.', $this->key); |
| 256 | 256 | |
| 257 | 257 | $record = (new BaseCollection($records)) |
| 258 | - ->filter(function ($value) use ($key, $parent) { |
|
| 258 | + ->filter(function($value) use ($key, $parent) { |
|
| 259 | 259 | return Arr::get($value, $key) == $parent->{$this->localKey}; |
| 260 | 260 | })->first(); |
| 261 | 261 | |
@@ -223,7 +223,7 @@ |
||
| 223 | 223 | $key = str_replace('->', '.', $this->key); |
| 224 | 224 | |
| 225 | 225 | $record = (new BaseCollection($records)) |
| 226 | - ->filter(function ($value) use ($key, $model) { |
|
| 226 | + ->filter(function($value) use ($key, $model) { |
|
| 227 | 227 | return Arr::get($value, $key) == $model->{$this->ownerKey}; |
| 228 | 228 | })->first(); |
| 229 | 229 | |
@@ -312,10 +312,10 @@ discard block |
||
| 312 | 312 | public function hasManyThroughJson( |
| 313 | 313 | string $related, |
| 314 | 314 | string $through, |
| 315 | - string|JsonKey $firstKey, |
|
| 315 | + string | JsonKey $firstKey, |
|
| 316 | 316 | string $secondKey = null, |
| 317 | 317 | string $localKey = null, |
| 318 | - string|JsonKey $secondLocalKey = null |
|
| 318 | + string | JsonKey $secondLocalKey = null |
|
| 319 | 319 | ) { |
| 320 | 320 | $relationships = []; |
| 321 | 321 | |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | } else { |
| 329 | 329 | if (!method_exists($through, 'belongsToJson')) { |
| 330 | 330 | //@codeCoverageIgnoreStart |
| 331 | - $message = 'Please add the HasJsonRelationships trait to the ' . $through::class . ' model.'; |
|
| 331 | + $message = 'Please add the HasJsonRelationships trait to the '.$through::class.' model.'; |
|
| 332 | 332 | |
| 333 | 333 | throw new RuntimeException($message); |
| 334 | 334 | // @codeCoverageIgnoreEnd |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | /** @var \Staudenmeir\EloquentJsonRelations\Relations\HasManyJson $hasManyJson */ |
| 368 | 368 | $hasManyJson = $relationships[0]; |
| 369 | 369 | |
| 370 | - $postGetCallback = function (Collection $models) use ($hasManyJson, $relationships) { |
|
| 370 | + $postGetCallback = function(Collection $models) use ($hasManyJson, $relationships) { |
|
| 371 | 371 | if (isset($models[0]->laravel_through_key)) { |
| 372 | 372 | $hasManyJson->hydratePivotRelation( |
| 373 | 373 | $models, |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | $hasManyThroughJson->withCustomEagerMatchingCallback( |
| 387 | - function (array $models, Collection $results, string $relation) use ($hasManyJson, $hasManyThroughJson) { |
|
| 387 | + function(array $models, Collection $results, string $relation) use ($hasManyJson, $hasManyThroughJson) { |
|
| 388 | 388 | foreach ($models as $model) { |
| 389 | 389 | $hasManyJson->hydratePivotRelation( |
| 390 | 390 | $model->$relation, |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | |
| 403 | 403 | $path = $belongsToJson->getForeignKeyPath(); |
| 404 | 404 | |
| 405 | - $postProcessor = function (Model $model, array $attributes) use ($belongsToJson, $path) { |
|
| 405 | + $postProcessor = function(Model $model, array $attributes) use ($belongsToJson, $path) { |
|
| 406 | 406 | $records = json_decode($attributes[$path], true); |
| 407 | 407 | |
| 408 | 408 | return $belongsToJson->pivotAttributes($model, $model, $records); |