From de187f0e278fe68b0afc59d9204c348111dddf50 Mon Sep 17 00:00:00 2001 From: Ben Everly Date: Thu, 6 Apr 2023 11:54:10 -0500 Subject: [PATCH] override user defined pivot accessor with default --- src/Cloner.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Cloner.php b/src/Cloner.php index 4b3ca8b..bd117a6 100644 --- a/src/Cloner.php +++ b/src/Cloner.php @@ -185,7 +185,7 @@ protected function duplicatePivotedRelation($relation, $relation_name, $clone) { if ($this->write_connection) return; // Loop trough current relations and attach to clone - $relation->get()->each(function ($foreign) use ($clone, $relation_name) { + $relation->as('pivot')->get()->each(function ($foreign) use ($clone, $relation_name) { $pivot_attributes = Arr::except($foreign->pivot->getAttributes(), [ $foreign->pivot->getRelatedKey(), $foreign->pivot->getForeignKey(),