twilio icon indicating copy to clipboard operation
twilio copied to clipboard

Bug? Unhandled match case on $driver in Laravel 9

Open jeffreyvanhees opened this issue 2 years ago • 1 comments

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 avatar Mar 15 '22 10:03 jeffreyvanhees

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!

jeffreyvanhees avatar Mar 15 '22 10:03 jeffreyvanhees