Skip to content

Commit a596448

Browse files
committed
fix: make the first resource type for a model take precedence
1 parent 07e8096 commit a596448

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Adapter/EloquentBuffer.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@ public static function load(Model $model, string $relationName, Relationship $re
5959
$constrain = [];
6060

6161
foreach ($resourceTypes as $resourceType) {
62-
if ($model = $resourceType->getAdapter()->model()) {
62+
if (
63+
($model = $resourceType->getAdapter()->model()) &&
64+
!isset($constrain[get_class($model)])
65+
) {
6366
$constrain[get_class($model)] = function ($query) use ($resourceType, $context) {
6467
$resourceType->applyScopes($query, $context);
6568
};

0 commit comments

Comments
 (0)