Skip to content
This repository was archived by the owner on Oct 20, 2025. It is now read-only.
Prev Previous commit
Next Next commit
Merge branch 'main' into pr/466
  • Loading branch information
pascalbaljet committed Mar 20, 2024
commit f59a1dc83462ea75f96cc062c6614c7d848aa044
10 changes: 4 additions & 6 deletions src/Components/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -369,16 +369,14 @@ private function getAttachedKeysFromRelation(string $relationName): ?array
$relation = $this->model->{$relationName}();

if ($relation instanceof BelongsToMany) {
$relatedKeyName = $relation->getRelatedKeyName();

return $loadedRelation->pluck($relatedKeyName)
return $loadedRelation->pluck($relation->getRelatedKeyName())
->map(fn ($key) => (string) $key)
->all();
}

if ($relation instanceof MorphMany) {
$parentKeyName = $relation->getLocalKeyName();

return $loadedRelation->pluck($parentKeyName)
return $loadedRelation->pluck($relation->getLocalKeyName())
->map(fn ($key) => (string) $key)
->all();
}

Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.