Skip to content

Commit

Permalink
Merge pull request #527 from m7moudabdel7mid/fix-type-always-gets-upd…
Browse files Browse the repository at this point in the history
…ated-issue

Fix issue - media type always gets updated on saving MorphMany relationship
  • Loading branch information
awcodes authored Aug 24, 2024
2 parents 0c09ab9 + e36865f commit 67c448a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Components/Forms/CuratorPicker.php
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,10 @@ public function relationship(string | Closure $relationshipName, string | Closur
$data[$typeColumn] = $typeValue;
}
if (isset($existingItems[$itemId])) {
$component->getRelationship()->where('media_id', $itemId)->update($data);
$component->getRelationship()
->where('media_id', $itemId)
->where($typeColumn, $typeValue)
->update($data);
} else {
$relationship->create($data);
}
Expand Down

0 comments on commit 67c448a

Please sign in to comment.