Skip to content

Commit dc8ec9e

Browse files
committed
Ensure Laravel feature is supported before using
1 parent cd9a43d commit dc8ec9e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Adapter/EloquentAdapter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,10 @@ public function load(array $models, array $relationships, Closure $scope, bool $
215215
$query = $relation->getQuery();
216216

217217
if (is_array($scope)) {
218-
// Requires Laravel 8.15+
219218
foreach ($scope as $v) {
219+
// Requires Laravel 8.15+
220220
$adapter = $v['resource']->getAdapter();
221-
if ($adapter instanceof self) {
221+
if ($adapter instanceof self && method_exists($relation, 'constrain')) {
222222
$relation->constrain([
223223
get_class($adapter->newModel()) => $v['scope']
224224
]);

0 commit comments

Comments
 (0)