This interface is needed when u want dispatch
event through the native laravel dispatcher
and not from Notifynder::fire()
/** * Handle the event * * @param NotifyListener $eventListener * @param null $notifynder * @return mixed */ public function handle(NotifyListener $eventListener, $notifynder = null) { $event = $eventListener->getNotifynderEvent(); $eventName = $this->getEventName($event->getEvent()); if ($this->listenerIsRegistered($eventName)) { // Make sure a notifynder instance is passed to the event // invoker method $notifynder = is_null($notifynder) ? $this->getNotifynder() : $notifynder; // Build the notifications $builtNotifications = call_user_func_array([$this, $eventName], [$event, $notifynder]); // If the listener is the NotifynderEvent that means // we are triggering this from the Notifynder::fire() // Event, it will take care of sending the notification if ($eventListener instanceof NotifynderEvent) { return $builtNotifications; } // Event has been dispatched manually from the native // Laravel eventing system then I'll send the notification // Right here if ($this->hasNotificationToSend([$builtNotifications])) { return $notifynder->send($builtNotifications); } } return null; }