Skip to content
This repository has been archived by the owner on Sep 22, 2024. It is now read-only.

Commit

Permalink
Parse id in case it's a model
Browse files Browse the repository at this point in the history
  • Loading branch information
pactode committed Sep 5, 2018
1 parent 70fc20e commit ad3fb27
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/BelongsToMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit ad3fb27

Please sign in to comment.