From 5c1c90c03f7f650a6a08d02826cd5c8c934a6ff9 Mon Sep 17 00:00:00 2001 From: Patrick Hoogkamer Date: Fri, 10 Feb 2017 12:16:44 +0100 Subject: [PATCH] Added laravel 5.4 compatibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit By using a wildcard in the event name Laravel will give us the event name in the event listener so we don’t have to call Event::firing (which doesn’t exist in Laravel 5.4) to get the name. --- src/Mpociot/CaptainHook/CaptainHookServiceProvider.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Mpociot/CaptainHook/CaptainHookServiceProvider.php b/src/Mpociot/CaptainHook/CaptainHookServiceProvider.php index f94f611..f9faba6 100644 --- a/src/Mpociot/CaptainHook/CaptainHookServiceProvider.php +++ b/src/Mpociot/CaptainHook/CaptainHookServiceProvider.php @@ -126,7 +126,7 @@ protected function publishSparkResources() protected function registerEventListeners() { foreach ($this->listeners as $eventName) { - $this->app['events']->listen($eventName, [$this, 'handleEvent']); + $this->app['events']->listen($eventName . '*', [$this, 'handleEvent']); } } @@ -201,11 +201,11 @@ public function setConfig($config) /** * Event listener. * + * @param $eventName * @param $eventData */ - public function handleEvent($eventData) + public function handleEvent($eventName, $eventData) { - $eventName = Event::firing(); $webhooks = $this->getWebhooks()->where('event', $eventName); $webhooks = $webhooks->filter($this->config->get('captain_hook.filter', null));