laravel-notification-channels / twilio

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

Bug? Unhandled match case on $driver in Laravel 9 #134

Open jeffreyvanhees opened 2 years ago

jeffreyvanhees commented 2 years ago

Versions: Laravel 9.0, latest version of this package.

When sending a notification I git the "Unhandled match case"-error. It occurred in   Illuminate / Notifications / RoutesNotifications.php on line 46.

It's trying to match the driver but it was not found:

public function routeNotificationFor($driver, $notification = null)
    {
        if (method_exists($this, $method = 'routeNotificationFor'.Str::studly($driver))) {
            return $this->{$method}($notification);
        }

       // Error occurred here:
        return match ($driver) {
            'database' => $this->notifications(),
            'mail' => $this->email,
        };
    }

I did everything according to the documentation. The notifiable model contains a routeNotificationForTwilio(), but $method = 'routeNotificationFor'.Str::studly($driver) returns "routeNotificationForNotificationChannels\Twilio\TwilioChannel" and I believe that's why the driver cannot be found.

jeffreyvanhees commented 2 years ago

After upgrading from 9.0 -> 9.4 it works again. Perhaps this was already known to you, but it might be good to take this into account in the minimal dependencies. :)

Thanks for the package!