Skip to content

Commit

Permalink
Update IsOfDescendantsRelation.php
Browse files Browse the repository at this point in the history
  • Loading branch information
SanderMuller committed Sep 9, 2024
1 parent 60550bd commit e6ae2f3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Eloquent/Relations/Traits/IsOfDescendantsRelation.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ protected function addExpression(callable $constraint, ?Builder $query = null, $
{
$name = $this->parent->getExpressionName();

/** @var \Staudenmeir\LaravelAdjacencyList\Eloquent\Builder<\Illuminate\Database\Eloquent\Model> $query */
$query = $query ?: $this->query;

$grammar = $this->getExpressionGrammar();
Expand All @@ -229,7 +230,6 @@ protected function addExpression(callable $constraint, ?Builder $query = null, $
$this->getRecursiveQuery($grammar, $selectPath)
);

/** @var \Staudenmeir\LaravelAdjacencyList\Eloquent\Builder<\Illuminate\Database\Eloquent\Model> $query */
$query->getQuery()->withRecursiveExpression($name, $expression->getQuery());

$query->withGlobalScope(get_class($this), function (Builder $query) use ($name) {
Expand Down

0 comments on commit e6ae2f3

Please sign in to comment.