Skip to content

Commit

Permalink
Merge branch '1.12'
Browse files Browse the repository at this point in the history
  • Loading branch information
staudenmeir committed Mar 30, 2023
2 parents 9b9fee6 + 3928fa7 commit 27f25c3
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/Eloquent/Relations/Siblings.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,15 @@ public function addEagerConstraints(array $models)
{
$keys = $this->getKeys($models, $this->localKey);

$this->query->whereIn($this->foreignKey, $keys);
$this->query->where(
function (Builder $query) use ($keys) {
$query->whereIn($this->foreignKey, $keys);

if (in_array(null, $keys, true)) {
$this->query->orWhereNull($this->foreignKey);
}
if (in_array(null, $keys, true)) {
$query->orWhereNull($this->foreignKey);
}
}
);
}

/**
Expand Down

0 comments on commit 27f25c3

Please sign in to comment.