Skip to content

Commit

Permalink
bugfix not returning parent result
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Ansmink authored and fico7489 committed Mar 8, 2018
1 parent 31e7f4a commit 5a960a2
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/Relations/BelongsToManyCustom.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ public function attach($ids, array $attributes = [], $touch = true)
list($idsOnly, $idsAttributes) = $this->getIdsWithAttributes($ids, $attributes);

$this->parent->fireModelEvent('pivotAttaching', true, $this->getRelationName(), $idsOnly, $idsAttributes);
parent::attach($ids, $attributes, $touch);
$parentResult = parent::attach($ids, $attributes, $touch);
$this->parent->fireModelEvent('pivotAttached', false, $this->getRelationName(), $idsOnly, $idsAttributes);

return $parentResult;
}

/**
Expand All @@ -41,8 +43,10 @@ public function detach($ids = null, $touch = true)
list($idsOnly) = $this->getIdsWithAttributes($ids);

$this->parent->fireModelEvent('pivotDetaching', true, $this->getRelationName(), $idsOnly);
parent::detach($ids, $touch);
$parentResult = parent::detach($ids, $touch);
$this->parent->fireModelEvent('pivotDetached', false, $this->getRelationName(), $idsOnly);

return $parentResult;
}

/**
Expand All @@ -58,8 +62,10 @@ public function updateExistingPivot($id, array $attributes, $touch = true)
list($idsOnly, $idsAttributes) = $this->getIdsWithAttributes($id, $attributes);

$this->parent->fireModelEvent('pivotUpdating', true, $this->getRelationName(), $idsOnly, $idsAttributes);
parent::updateExistingPivot($id, $attributes, $touch);
$parentResult = parent::updateExistingPivot($id, $attributes, $touch);
$this->parent->fireModelEvent('pivotUpdated', false, $this->getRelationName(), $idsOnly, $idsAttributes);

return $parentResult;
}

/**
Expand Down

0 comments on commit 5a960a2

Please sign in to comment.