Closed 1stevengrant closed 6 years ago
I have a notification when a model is updated. The first task was to send the notification to Slack which works as expected.
public function toSlack($notifiable) { // Log::info($notifiable); return (new SlackMessage) ->success() ->from('Taxi Controller', ':taxi:') ->content(":wave: <!channel> : #" . $notifiable->id ." picked up by " . $notifiable->driver->name); }
Next I wanted to log the notifications to the database, this also works.
public function toArray($notifiable) { return [ 'driver_name' => $notifiable->driver->name, 'date_accepted' => $notifiable->date_accepted, 'address' => $notifiable->address, 'mobile_phone' => $notifiable->mobile_phone, ]; }
Then, we looked to hook into the Nexmo channel - but the toNexmo method doesn't seem to fire.
toNexmo
public function toNexmo($notifiable) { Log::info($notifiable); }
the via method has
via
public function via($notifiable) { return [ 'slack', 'nexmo', 'database' ]; }
services.php has been updated and nexmo/client composer package installed.
services.php
nexmo/client
'nexmo' => [ 'key' => env('NEXMO_KEY'), 'secret' => env('NEXMO_SECRET'), 'sms_from' => env('NEXMO_NUMBER'), ],
Turns out you actually need to fire a new Nexmo message and not just log.
Not ideal as I don't want to fire an SMS each time
Did you solve it? It's my problem too.
Description:
I have a notification when a model is updated. The first task was to send the notification to Slack which works as expected.
Next I wanted to log the notifications to the database, this also works.
Then, we looked to hook into the Nexmo channel - but the
toNexmo
method doesn't seem to fire.the
via
method hasservices.php
has been updated andnexmo/client
composer package installed.Steps To Reproduce: