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

[5.6] Allow notification routing to depend on notification being sent #22289

Merged
merged 4 commits into from
Dec 3, 2017
Merged

[5.6] Allow notification routing to depend on notification being sent #22289

merged 4 commits into from
Dec 3, 2017

Conversation

freekmurze
Copy link
Contributor

This PR makes notification routing a bit more flexible by passing the notification to the routeNotificationForXXX

If this would be accepted, this would become possible:

// on a Notifiable

public function routeNotificationForSlack($notification)
{
    if ($notification instanceof MySpecialSnowflakeNotification) {
        return $this->alternative_slack_webhook;
    }
    return $this->slack_webhook;
}

Didn't yet figure out how the new behaviour can be tested properly.

@freekmurze freekmurze changed the title Allow notification routing to depend on notification being sent [5.5] Allow notification routing to depend on notification being sent Dec 2, 2017
@Dylan-DPC-zz
Copy link

Couldn't this be considered breaking because you changed the signature of a public and protected functions that may have some effect?

@taylorotwell taylorotwell changed the base branch from 5.5 to master December 3, 2017 14:51
@taylorotwell taylorotwell merged commit 1973bd0 into laravel:master Dec 3, 2017
@taylorotwell
Copy link
Member

Merged into 5.6. One question I do have is when would the notification ever be null in RoutesNotifications. I see you made the parameter optional there.

@freekmurze freekmurze deleted the flexible-notification-routing branch December 3, 2017 18:34
@freekmurze
Copy link
Contributor Author

The notification will never be null. It was handy to have that parameter as optional while developing the PR. Forgot to make it required when sending the PR.

@Modelizer
Copy link
Contributor

Change log is pointing to 5.5. :/
Also title need to be updated to [5.6]

@freekmurze freekmurze changed the title [5.5] Allow notification routing to depend on notification being sent [5.6] Allow notification routing to depend on notification being sent Dec 4, 2017
@aaronhuisinga
Copy link

@freekmurze I was just about to open a PR for the same exact thing. Found your Laracasts thread, and found you'd already done it! Thanks!

@meyer59
Copy link

meyer59 commented Feb 8, 2018

Maybe this breaking change should reflect in the upgrade guide to 5.6

aaronhuisinga pushed a commit to aaronhuisinga/apn that referenced this pull request Feb 23, 2018
This adds support for the feature added in Laravel 5.6 for routing based on the notification being sent (laravel/framework#22289).
aaronhuisinga pushed a commit to aaronhuisinga/gcm that referenced this pull request Feb 23, 2018
This adds support for the feature added in Laravel 5.6 for routing based on the notification being sent (laravel/framework#22289).
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.

7 participants