diff --git a/src/Relations/BelongsToManyKeys.php b/src/Relations/BelongsToManyKeys.php index 387e1c6..02926e9 100644 --- a/src/Relations/BelongsToManyKeys.php +++ b/src/Relations/BelongsToManyKeys.php @@ -64,7 +64,7 @@ public function addEagerConstraints(array $models): void $foreignKey = $this->foreignKey; $desireValues = []; foreach ($localKeys as $localKey) { - $desireValues = array_merge($desireValues, $this->getKeys($models, $localKey) ?? []); + $desireValues = array_merge($desireValues, $this->getKeys($models, $localKey)); } $this->query->whereIn($foreignKey, array_filter(array_unique($desireValues))); }