Skip to content

Commit 3fe245b

Browse files
authored
Merge pull request #547 from kohlerdominik/fix-undefined-key-error
Fixed Undefined Key error in nested relationship
2 parents 7e631db + 67f1867 commit 3fe245b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: src/BaseRelation.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public function addEagerConstraints(array $models)
158158
// The first model in the array is always the parent, so add the scope constraints based on that model.
159159
// @link https://github.com/laravel/framework/pull/25240
160160
// @link https://github.com/lazychaser/laravel-nestedset/issues/351
161-
optional($models[0])->applyNestedSetScope($this->query);
161+
optional(reset($models))->applyNestedSetScope($this->query);
162162

163163
$this->query->whereNested(function (Builder $inner) use ($models) {
164164
// We will use this query in order to apply constraints to the

0 commit comments

Comments
 (0)