From c1778eebd69ed8834b3697e98799b4704ebbd04d Mon Sep 17 00:00:00 2001 From: Sam Ansmink Date: Thu, 8 Mar 2018 16:03:42 +0100 Subject: [PATCH] bugfix not returning parent result --- src/Relations/BelongsToManyCustom.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Relations/BelongsToManyCustom.php b/src/Relations/BelongsToManyCustom.php index bd1c842..3533134 100644 --- a/src/Relations/BelongsToManyCustom.php +++ b/src/Relations/BelongsToManyCustom.php @@ -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; } /** @@ -37,8 +39,10 @@ public function detach($ids = [], $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; } /** @@ -54,8 +58,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; } /**