@@ -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"]; |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | public function compileInitialPath($column, $alias) |
13 | 13 | { |
14 | - return 'cast(' . $this->wrap($column) . ' as varchar(8191)) as ' . $this->wrap($alias); |
|
14 | + return 'cast('.$this->wrap($column).' as varchar(8191)) as '.$this->wrap($alias); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | public function compileRecursivePath($column, $alias, bool $reverse = false) |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | public function selectPathList(Builder $query, $expression, $column, $pathSeparator, $listSeparator) |
32 | 32 | { |
33 | 33 | return $query->selectRaw( |
34 | - 'list(' . $this->wrap($column) . ", '$listSeparator')" |
|
34 | + 'list('.$this->wrap($column).", '$listSeparator')" |
|
35 | 35 | )->from($expression); |
36 | 36 | } |
37 | 37 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | public function compileCycleDetectionInitialSelect(string $column): string |
57 | 57 | { |
58 | - return 'false as ' . $this->wrap($column); |
|
58 | + return 'false as '.$this->wrap($column); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | public function compileCycleDetectionRecursiveSelect(string $sql, string $column): string |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | |
66 | 66 | public function compileCycleDetectionStopConstraint(string $column): string |
67 | 67 | { |
68 | - return 'not ' . $this->wrap($column); |
|
68 | + return 'not '.$this->wrap($column); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | public function supportsUnionInRecursiveExpression(): bool |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | $query = $this->newModelQuery() |
130 | 130 | ->select("$table.*") |
131 | - ->selectRaw($initialDepth . ' as ' . $depth) |
|
131 | + ->selectRaw($initialDepth.' as '.$depth) |
|
132 | 132 | ->selectRaw($initialPath) |
133 | 133 | ->from($from); |
134 | 134 | |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | |
195 | 195 | $null = $grammar->compilePivotColumnNullValue($columnDefinition['type_name'], $columnDefinition['type']); |
196 | 196 | |
197 | - $query->selectRaw("$null as " . $grammar->wrap("pivot_$column")); |
|
197 | + $query->selectRaw("$null as ".$grammar->wrap("pivot_$column")); |
|
198 | 198 | } |
199 | 199 | } else { |
200 | 200 | foreach ($columns as $column) { |
@@ -273,16 +273,16 @@ discard block |
||
273 | 273 | |
274 | 274 | $joinColumns = [ |
275 | 275 | 'asc' => [ |
276 | - $name . '.' . $this->getLocalKeyName(), |
|
276 | + $name.'.'.$this->getLocalKeyName(), |
|
277 | 277 | $this->getQualifiedChildKeyName(), |
278 | 278 | ], |
279 | 279 | 'desc' => [ |
280 | - $name . '.' . $this->getLocalKeyName(), |
|
280 | + $name.'.'.$this->getLocalKeyName(), |
|
281 | 281 | $this->getQualifiedParentKeyName(), |
282 | 282 | ], |
283 | 283 | ]; |
284 | 284 | |
285 | - $recursiveDepth = $depth . ' ' . ($direction === 'asc' ? '-' : '+') . ' 1'; |
|
285 | + $recursiveDepth = $depth.' '.($direction === 'asc' ? '-' : '+').' 1'; |
|
286 | 286 | |
287 | 287 | $recursivePath = $grammar->compileRecursivePath( |
288 | 288 | $this->getQualifiedLocalKeyName(), |
@@ -292,8 +292,8 @@ discard block |
||
292 | 292 | $recursivePathBindings = $grammar->getRecursivePathBindings($this->getPathSeparator()); |
293 | 293 | |
294 | 294 | $query = $this->newModelQuery() |
295 | - ->select($table . '.*') |
|
296 | - ->selectRaw($recursiveDepth . ' as ' . $depth) |
|
295 | + ->select($table.'.*') |
|
296 | + ->selectRaw($recursiveDepth.' as '.$depth) |
|
297 | 297 | ->selectRaw($recursivePath, $recursivePathBindings) |
298 | 298 | ->from($from); |
299 | 299 |