diff --git a/src/BelongsToMany.php b/src/BelongsToMany.php index 0f9e1a0..46f8f1d 100644 --- a/src/BelongsToMany.php +++ b/src/BelongsToMany.php @@ -17,7 +17,7 @@ class BelongsToMany extends BaseBelongsToMany public function attach($id, array $attributes = [], $touch = true) { $this->parent->setPivotChanges('attach', $this->getRelationName(), [ - $id => $attributes, + $this->parseId($id) => $attributes, ]); if ($this->parent->firePivotAttachingEvent() === false) { @@ -74,7 +74,7 @@ public function detach($ids = null, $touch = true) public function updateExistingPivot($id, array $attributes, $touch = true) { $this->parent->setPivotChanges('update', $this->getRelationName(), [ - $id => $attributes, + $this->parseId($id) => $attributes, ]); if ($this->parent->firePivotUpdatingEvent() === false) {