@@ -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 | }); |