laravel-notification-channels / twilio

Twilio notifications channel for Laravel
https://laravel-notification-channels.com
227 stars 36 forks source link

On demand notifications doesn't work #58

Closed conradwarhol closed 4 years ago

conradwarhol commented 5 years ago

On-demand notifications (as documented here) does not seem to be working with this channel:

\Notification::route(TwilioChannel::class, $phoneNumber)->notify(new MyNotification($data));

Typical notifications with notifiable model work as expected:

$user->notify(new MyNotification($data));

Note: I am using a service_sid and not a from number in config. My laravel version is 5.6

Any ideas?

UPDATE

It works when i use "twilio" instead of class name:

\Notification::route("twilio", $phoneNumber)->notify(new MyNotification($data));

Dahdoul commented 5 years ago

Same issue here using Laravel 5.8

conradwarhol commented 5 years ago

I just checked and it works when i use "twilio" instead of class name:

\Notification::route("twilio", $phoneNumber)->notify(new MyNotification($data));

Maybe this behvaiour should be documented.

atymic commented 5 years ago

I'll try and investigate this when I have a chance.

miken32 commented 4 years ago

This is because TwilioChannel::getTo() is doing this:

        if ($notifiable->routeNotificationFor('twilio')) {
            return $notifiable->routeNotificationFor('twilio');
        }