@@ -176,7 +176,7 @@ |
||
176 | 176 | */ |
177 | 177 | protected function formatIds(array $ids) |
178 | 178 | { |
179 | - return (new BaseCollection($ids))->mapWithKeys(function ($attributes, $id) { |
|
179 | + return (new BaseCollection($ids))->mapWithKeys(function($attributes, $id) { |
|
180 | 180 | if (!is_array($attributes)) { |
181 | 181 | [$id, $attributes] = [$attributes, []]; |
182 | 182 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | protected function addRelationship(ModelsCommand $command, ReflectionMethod $method, Relation $relationship): void |
48 | 48 | { |
49 | - $type = '\\' . Collection::class . '|\\' . $relationship->getRelated()::class . '[]'; |
|
49 | + $type = '\\'.Collection::class.'|\\'.$relationship->getRelated()::class.'[]'; |
|
50 | 50 | |
51 | 51 | $command->setProperty( |
52 | 52 | $method->getName(), |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | ); |
57 | 57 | |
58 | 58 | $command->setProperty( |
59 | - Str::snake($method->getName()) . '_count', |
|
59 | + Str::snake($method->getName()).'_count', |
|
60 | 60 | 'int', |
61 | 61 | true, |
62 | 62 | false, |
@@ -71,18 +71,18 @@ |
||
71 | 71 | */ |
72 | 72 | public function compileMemberOf(string $column, ?string $objectKey, mixed $value): string |
73 | 73 | { |
74 | - $columnWithKey = $objectKey ? $column . (str_contains($column, '->') ? '[*]' : '') . "->$objectKey" : $column; |
|
74 | + $columnWithKey = $objectKey ? $column.(str_contains($column, '->') ? '[*]' : '')."->$objectKey" : $column; |
|
75 | 75 | |
76 | 76 | [$field, $path] = $this->wrapJsonFieldAndPath($columnWithKey); |
77 | 77 | |
78 | 78 | if ($objectKey && !str_contains($column, '->')) { |
79 | - $path = ", '$[*]" . substr($path, 4); |
|
79 | + $path = ", '$[*]".substr($path, 4); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | $sql = $path ? "json_extract($field$path)" : $field; |
83 | 83 | |
84 | 84 | if ($value instanceof Expression) { |
85 | - return $value->getValue($this) . " member of($sql)"; |
|
85 | + return $value->getValue($this)." member of($sql)"; |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | return "? member of($sql)"; |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | protected function addEagerConstraintsWithCompositeKey(array $models): void |
47 | 47 | { |
48 | 48 | $keys = (new BaseCollection($models))->map( |
49 | - function (Model $model) { |
|
49 | + function(Model $model) { |
|
50 | 50 | return array_map( |
51 | 51 | fn (string $column) => $model[$column], |
52 | 52 | $this->localKey |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | )->values()->unique(null, true)->all(); |
56 | 56 | |
57 | 57 | $this->query->where( |
58 | - function (Builder $query) use ($keys) { |
|
58 | + function(Builder $query) use ($keys) { |
|
59 | 59 | foreach ($keys as $key) { |
60 | 60 | $query->orWhere( |
61 | - function (Builder $query) use ($key) { |
|
61 | + function(Builder $query) use ($key) { |
|
62 | 62 | foreach ($this->foreignKey as $i => $column) { |
63 | 63 | if ($i === 0) { |
64 | 64 | $this->whereJsonContainsOrMemberOf( |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | $additionalColumns |
134 | 134 | ); |
135 | 135 | |
136 | - foreach($result->$foreignKey as $value) { |
|
136 | + foreach ($result->$foreignKey as $value) { |
|
137 | 137 | $values = [$value, ...$additionalValues]; |
138 | 138 | |
139 | 139 | $key = implode("\0", $values); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | protected function addEagerConstraintsWithCompositeKey(array $models): void |
47 | 47 | { |
48 | 48 | $keys = (new BaseCollection($models))->map( |
49 | - function (Model $model) { |
|
49 | + function(Model $model) { |
|
50 | 50 | return array_map( |
51 | 51 | fn (string $column) => $model[$column], |
52 | 52 | $this->foreignKey |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | )->values()->unique(null, true)->all(); |
56 | 56 | |
57 | 57 | $this->query->where( |
58 | - function (Builder $query) use ($keys) { |
|
58 | + function(Builder $query) use ($keys) { |
|
59 | 59 | foreach ($keys as $key) { |
60 | 60 | $query->orWhere( |
61 | - function (Builder $query) use ($key) { |
|
61 | + function(Builder $query) use ($key) { |
|
62 | 62 | foreach ($this->ownerKey as $i => $column) { |
63 | 63 | if ($i === 0) { |
64 | 64 | $query->whereIn( |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | $parentKeys = $this->getKeys($models, $this->localKey); |
130 | 130 | |
131 | - $this->query->where(function (Builder $query) use ($parentKeys) { |
|
131 | + $this->query->where(function(Builder $query) use ($parentKeys) { |
|
132 | 132 | foreach ($parentKeys as $parentKey) { |
133 | 133 | $this->whereJsonContainsOrMemberOf( |
134 | 134 | $query, |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | */ |
267 | 267 | public function getRelationExistenceQueryForSelfRelation(Builder $query, Builder $parentQuery, $columns = ['*']) |
268 | 268 | { |
269 | - $query->from($query->getModel()->getTable() . ' as ' . $hash = $this->getRelationCountHash()); |
|
269 | + $query->from($query->getModel()->getTable().' as '.$hash = $this->getRelationCountHash()); |
|
270 | 270 | |
271 | 271 | $query->getModel()->setTable($hash); |
272 | 272 | |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | |
277 | 277 | $this->whereJsonContainsOrMemberOf( |
278 | 278 | $query, |
279 | - $hash . '.' . $this->getPathName(), |
|
279 | + $hash.'.'.$this->getPathName(), |
|
280 | 280 | $query->getQuery()->connection->raw($sql) |
281 | 281 | ); |
282 | 282 | |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | $localKey = $this->hasCompositeKey() ? $this->localKey[0] : $this->localKey; |
333 | 333 | |
334 | 334 | $record = (new BaseCollection($records)) |
335 | - ->filter(function ($value) use ($key, $localKey, $parent) { |
|
335 | + ->filter(function($value) use ($key, $localKey, $parent) { |
|
336 | 336 | return Arr::get($value, $key) == $parent->$localKey; |
337 | 337 | })->first(); |
338 | 338 |
@@ -315,7 +315,7 @@ |
||
315 | 315 | $ownerKey = $this->hasCompositeKey() ? $this->ownerKey[0] : $this->ownerKey; |
316 | 316 | |
317 | 317 | $record = (new BaseCollection($records)) |
318 | - ->filter(function ($value) use ($key, $model, $ownerKey) { |
|
318 | + ->filter(function($value) use ($key, $model, $ownerKey) { |
|
319 | 319 | return Arr::get($value, $key) == $model->$ownerKey; |
320 | 320 | })->first(); |
321 | 321 |
@@ -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'); |