From eb999fe40c6c4291f04a86ed998e8c90fc786397 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rok=20Andr=C3=A9e?= Date: Fri, 28 Aug 2020 14:57:56 +0200 Subject: [PATCH] Fix onCloned This should fix the #34 issue where onCloned is called too early. --- src/Cloner.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Cloner.php b/src/Cloner.php index 585cdc0..5b98fbe 100644 --- a/src/Cloner.php +++ b/src/Cloner.php @@ -57,10 +57,10 @@ public function duplicate($model, $relation = null) { $this->duplicateAttachments($model, $clone); $clone->save(); - $this->dispatchOnClonedEvent($clone, $model); - $this->cloneRelations($model, $clone); - + + $this->dispatchOnClonedEvent($clone, $model); + return $clone; }