Skip to content

Commit 8da4ae6

Browse files
committed
Add event Lumen support #23
1 parent 729e8c7 commit 8da4ae6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/TwilioChannel.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,12 @@ public function send($notifiable, Notification $notification)
5757

5858
return $this->twilio->sendMessage($message, $to, $useSender);
5959
} catch (Exception $exception) {
60-
$this->events->fire(
61-
new NotificationFailed($notifiable, $notification, 'twilio', ['message' => $exception->getMessage(), 'exception' => $exception])
62-
);
60+
$event = new NotificationFailed($notifiable, $notification, 'twilio', ['message' => $exception->getMessage(), 'exception' => $exception]);
61+
if (function_exists('event')) { // Use event helper when possible to add Lumen support
62+
event($event);
63+
} else {
64+
$this->events->fire($event);
65+
}
6366
}
6467
}
6568

0 commit comments

Comments
 (0)