From 3a3e883216d7b81e41be055c5c09447b2b81184f Mon Sep 17 00:00:00 2001 From: Erik Sanders Date: Tue, 12 Mar 2019 14:34:15 +0100 Subject: [PATCH 1/2] Laravel 5.8 fix - In Laravel 5.4 the fire method for events was renamed to dispatch. The fire method has been an alias to dispatch until 5.8. --- src/Cloner.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Cloner.php b/src/Cloner.php index 8284fec..6f57388 100644 --- a/src/Cloner.php +++ b/src/Cloner.php @@ -110,7 +110,7 @@ protected function saveClone($clone, $relation = null, $src, $child = null) { // Notify listeners via callback or event if (method_exists($clone, 'onCloning')) $clone->onCloning($src, $child); - $this->events->fire('cloner::cloning: '.get_class($src), [$clone, $src]); + $this->events->dispatch('cloner::cloning: '.get_class($src), [$clone, $src]); // Do the save if ($relation) $relation->save($clone); @@ -118,7 +118,7 @@ protected function saveClone($clone, $relation = null, $src, $child = null) { // Notify listeners via callback or event if (method_exists($clone, 'onCloned')) $clone->onCloned($src); - $this->events->fire('cloner::cloned: '.get_class($src), [$clone, $src]); + $this->events->dispatch('cloner::cloned: '.get_class($src), [$clone, $src]); } /** From ce3ae0cdd67b77df8081e816096b41f900d51d7b Mon Sep 17 00:00:00 2001 From: Erik Sanders Date: Tue, 12 Mar 2019 16:17:38 +0100 Subject: [PATCH 2/2] - Updated unit test --- tests/FunctionalTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/FunctionalTest.php b/tests/FunctionalTest.php index 01b881f..0f87acd 100644 --- a/tests/FunctionalTest.php +++ b/tests/FunctionalTest.php @@ -49,7 +49,7 @@ protected function initUpchuck() { } protected function mockEvents() { - return m::mock('Illuminate\Events\Dispatcher', [ 'fire' => null ]); + return m::mock('Illuminate\Events\Dispatcher', [ 'dispatch' => null ]); } // https://github.com/laracasts/TestDummy/blob/master/tests/FactoryTest.php#L18