Skip to content

Commit bb87e58

Browse files
committed
fix: preparing pivot resources with custom key
1 parent 698a6d0 commit bb87e58

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Concerns/HandlesRelationManyToManyOperations.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ protected function preparePivotResources(array $resources): array
158158
$model = $this->getModel();
159159
$resources = $this->standardizePivotResourcesArray($resources);
160160
$resourceModel = (new $model)->{$this->getRelation()}()->getModel();
161-
$resourceKeyName = $resourceModel->getKeyName();
161+
$resourceKeyName = $this->keyName();
162162
$resourceModels = $resourceModel->whereIn($resourceKeyName, array_keys($resources))->get();
163163

164164
$resources = array_filter(

0 commit comments

Comments
 (0)