Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Laravel 9.x #128

Merged
merged 7 commits into from
Feb 14, 2022

Conversation

marcroberts
Copy link

No description provided.

@marcroberts
Copy link
Author

Now that Laravel 9 has been released al the tests related to this change are now passing - https://github.com/marcroberts/twilio/runs/5019943008

@L3o-pold
Copy link

L3o-pold commented Feb 9, 2022

With the introduction of this PR and this change

this part can't work and throw an exception:

#0 /var/www/html/vendor/laravel-notification-channels/twilio/src/TwilioChannel.php(89): App\\Models\\Registration->routeNotificationFor('NotificationCha...', Object(App\\Notifications\\Register))
#1 /var/www/html/vendor/laravel-notification-channels/twilio/src/TwilioChannel.php(47): NotificationChannels\\Twilio\\TwilioChannel->getTo(Object(App\\Models\\Registration), Object(App\\Notifications\\Register))
#2 /var/www/html/vendor/laravel/framework/src/Illuminate/Notifications/NotificationSender.php(148): NotificationChannels\\Twilio\\TwilioChannel->send(Object(App\\Models\\Registration), Object(App\\Notifications\\Register))
#3 /var/www/html/vendor/laravel/framework/src/Illuminate/Notifications/NotificationSender.php(106): Illuminate\\Notifications\\NotificationSender->sendToNotifiable(Object(App\\Models\\Registration), '4a788d2a-df79-4...', Object(App\\Notifications\\Register), 'NotificationCha...')

@marcroberts
Copy link
Author

Hmm

Looking back at the changes to that file, the comments indicate that the routeNotificationsFor() method in Laravel has been expecting the $driver parameter to be a string since at least as far back as Laravel 5.5

Shall we remove

if ($notifiable->routeNotificationFor(self::class, $notification))
    return $notifiable->routeNotificationFor(self::class, $notification);
}

And rely on the string call afterwards?

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

@L3o-pold
Copy link

L3o-pold commented Feb 9, 2022

We should wait for laravel/framework#40880

@L3o-pold
Copy link

L3o-pold commented Feb 9, 2022

Hmm

Looking back at the changes to that file, the comments indicate that the routeNotificationsFor() method in Laravel has been expecting the $driver parameter to be a string since at least as far back as Laravel 5.5

Shall we remove

if ($notifiable->routeNotificationFor(self::class, $notification))
    return $notifiable->routeNotificationFor(self::class, $notification);
}

And rely on the string call afterwards?

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

self::class is a string

@marcroberts
Copy link
Author

self::class is a string

Of course it is 🤦‍♂️

I'll revert that commit, and add a test to cover this issue

@marcroberts
Copy link
Author

I'm not sure we need to test actually. If we're going to wait for the fix upstream we can just change the dependency to be ^9.0.1 (or whatever the release is) instead.

If wanted, the failure can be reproduced in the tests by removing the empty routeNotificationsFor method in the Notifiable class within TwilioChannelTest and replacing it was use RoutesNotifications;

@marcroberts
Copy link
Author

Laravel 9.0.1 has just been released which includes laravel/framework#40880

I've also removed the Laravel 6 & PHP 8.1 combination from the actions workflow (This seemed to pass before but Laravel 6 does not support PHP 8.1).

@miken32 miken32 mentioned this pull request Feb 10, 2022
@onlime
Copy link

onlime commented Feb 11, 2022

@marcroberts thanks for your PR. Anything holding you back from merging it? Who is the maintainer of this package?

I have tested it and didn't run into any issues. Installed it in a Laravel 9 project using the following in composer.json:

    "repositories": [
        {
            "type": "git",
            "url": "https://github.com/marcroberts/twilio.git"
        }
    ],
    "require": {
        "laravel-notification-channels/twilio": "dev-laravel9"
    },
    "minimum-stability": "dev",
    "prefer-stable": true

@miken32
Copy link

miken32 commented Feb 12, 2022

Last couple of PRs were approved by @atymic but the last one was a year ago...

@atymic atymic merged commit c14bafb into laravel-notification-channels:master Feb 14, 2022
@marcroberts marcroberts deleted the laravel9 branch February 15, 2022 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants