@@ -25,8 +25,8 @@ |
||
25 | 25 | } |
26 | 26 | |
27 | 27 | $parentKeyName = $this->first->relationLoaded('pivot') |
28 | - ? 'pivot.' . $this->first()->getParentKeyName() |
|
29 | - : 'pivot_' . $this->first()->getParentKeyName(); |
|
28 | + ? 'pivot.'.$this->first()->getParentKeyName() |
|
29 | + : 'pivot_'.$this->first()->getParentKeyName(); |
|
30 | 30 | $localKeyName = $this->first()->getLocalKeyName(); |
31 | 31 | $depthName = $this->first()->getDepthName(); |
32 | 32 |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function scopeTree(Builder $query, $maxDepth = null) |
20 | 20 | { |
21 | - $constraint = function (Builder $query) { |
|
21 | + $constraint = function(Builder $query) { |
|
22 | 22 | $query->isRoot(); |
23 | 23 | }; |
24 | 24 | |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @param int|null $maxDepth |
34 | 34 | * @return \Illuminate\Database\Eloquent\Builder |
35 | 35 | */ |
36 | - public function scopeTreeOf(Builder $query, callable|Model $constraint, $maxDepth = null) |
|
36 | + public function scopeTreeOf(Builder $query, callable | Model $constraint, $maxDepth = null) |
|
37 | 37 | { |
38 | 38 | if ($constraint instanceof Model) { |
39 | 39 | $constraint = fn ($query) => $query->whereKey($constraint->getKey()); |
@@ -291,20 +291,20 @@ discard block |
||
291 | 291 | protected function addRecursiveQueryJoinsAndConstraints(Builder $query, $direction, $name, array $joinColumns) |
292 | 292 | { |
293 | 293 | if ($direction === 'both') { |
294 | - $query->join($name, function (JoinClause $join) use ($joinColumns) { |
|
294 | + $query->join($name, function(JoinClause $join) use ($joinColumns) { |
|
295 | 295 | $join->on($joinColumns['asc'][0], '=', $joinColumns['asc'][1]) |
296 | 296 | ->orOn($joinColumns['desc'][0], '=', $joinColumns['desc'][1]); |
297 | 297 | }); |
298 | 298 | |
299 | 299 | $depth = $this->getDepthName(); |
300 | 300 | |
301 | - $query->where(function (Builder $query) use ($depth, $joinColumns) { |
|
301 | + $query->where(function(Builder $query) use ($depth, $joinColumns) { |
|
302 | 302 | $query->where($depth, '=', 0) |
303 | - ->orWhere(function (Builder $query) use ($depth, $joinColumns) { |
|
303 | + ->orWhere(function(Builder $query) use ($depth, $joinColumns) { |
|
304 | 304 | $query->whereColumn($joinColumns['asc'][0], '=', $joinColumns['asc'][1]) |
305 | 305 | ->where($depth, '<', 0); |
306 | 306 | }) |
307 | - ->orWhere(function (Builder $query) use ($depth, $joinColumns) { |
|
307 | + ->orWhere(function(Builder $query) use ($depth, $joinColumns) { |
|
308 | 308 | $query->whereColumn($joinColumns['desc'][0], '=', $joinColumns['desc'][1]) |
309 | 309 | ->where($depth, '>', 0); |
310 | 310 | }); |
@@ -19,7 +19,7 @@ |
||
19 | 19 | ); |
20 | 20 | |
21 | 21 | $parentKey = $this->related->qualifyColumn( |
22 | - "pivot_" . $this->related->getParentKeyName() |
|
22 | + "pivot_".$this->related->getParentKeyName() |
|
23 | 23 | ); |
24 | 24 | |
25 | 25 | return ["$path as {$alias}", "$parentKey as {$alias}_pivot_id"]; |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | public function appendToDeepRelationship(array $through, array $foreignKeys, array $localKeys, int $position): array |
23 | 23 | { |
24 | 24 | if ($position === 0) { |
25 | - $foreignKeys[] = function (Builder $query, Builder $parentQuery = null) { |
|
25 | + $foreignKeys[] = function(Builder $query, Builder $parentQuery = null) { |
|
26 | 26 | if ($parentQuery) { |
27 | 27 | $this->getRelationExistenceQuery($this->query, $parentQuery); |
28 | 28 | } |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $pathSeparator = $this->related->getPathSeparator(); |
177 | 177 | |
178 | 178 | if ($this->andSelf) { |
179 | - return $results->mapToDictionary(function (Model $result) use ($pathSeparator) { |
|
179 | + return $results->mapToDictionary(function(Model $result) use ($pathSeparator) { |
|
180 | 180 | return [strtok($result->laravel_through_key, $pathSeparator) => $result]; |
181 | 181 | })->all(); |
182 | 182 | } |
@@ -19,7 +19,7 @@ |
||
19 | 19 | ); |
20 | 20 | |
21 | 21 | $childKey = $this->related->qualifyColumn( |
22 | - "pivot_" . $this->related->getChildKeyName() |
|
22 | + "pivot_".$this->related->getChildKeyName() |
|
23 | 23 | ); |
24 | 24 | |
25 | 25 | return ["$path as {$alias}", "$childKey as {$alias}_pivot_id"]; |