Skip to content

Commit

Permalink
Add event Lumen support #23
Browse files Browse the repository at this point in the history
  • Loading branch information
gregoriohc committed Mar 16, 2018
1 parent 729e8c7 commit 8da4ae6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/TwilioChannel.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,12 @@ public function send($notifiable, Notification $notification)

return $this->twilio->sendMessage($message, $to, $useSender);
} catch (Exception $exception) {
$this->events->fire(
new NotificationFailed($notifiable, $notification, 'twilio', ['message' => $exception->getMessage(), 'exception' => $exception])
);
$event = new NotificationFailed($notifiable, $notification, 'twilio', ['message' => $exception->getMessage(), 'exception' => $exception]);
if (function_exists('event')) { // Use event helper when possible to add Lumen support
event($event);
} else {
$this->events->fire($event);
}
}
}

Expand Down

0 comments on commit 8da4ae6

Please sign in to comment.