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

Pass the notification object to the routeNotificationFor method #64

Conversation

sateshpersaud
Copy link

This allows the developer to access the notification here:

public function routeNotificationForOneSignal(Notification $notification)
{
    // access $notification here
}

This allows the developer to access the notification here:
public function routeNotificationForOneSignal(Notification $notification)
{
    // access $notification here
}
@LKaemmerling
Copy link
Collaborator

Could you please rebase this on the refactor-to-traits branch?

@timacdonald how usefully do you find this?

satesh added 2 commits April 20, 2018 09:12
This allows the developer to access the notification here:
public function routeNotificationForOneSignal(Notification $notification)
{
    // access $notification here
}
…github.com:SateshPersaud/onesignal into pass-notification-to-route-notification-for-method
@LKaemmerling LKaemmerling changed the base branch from master to refactor-to-traits April 20, 2018 13:16
@timacdonald
Copy link
Contributor

timacdonald commented Apr 22, 2018

It looks like this functionality is new in 5.6: laravel/framework#22289

I think if it is supported in core it makes sense to add it. I personally don't have a need for it, but obviously it is something that could be handy in some instances.

This is also relevant: https://laracasts.com/discuss/channels/laravel/how-to-route-notifications-based-on-the-notification-being-sent

@LKaemmerling
Copy link
Collaborator

Okay, this leads us to the problem that we must drop support < 5.6 for this... i think this isn't a good solution @Lloople what do you think?

@timacdonald
Copy link
Contributor

I'm not 100% that it will be a breaking change.

<5.6 is expecting one argument - the $driver
5.6+ is expecting 2 arguments $driver and an optional $notification.

In PHP if a function has explicit parameters - like these do, but is passed more arguments than it is expecting it will just ignore the additional arguments.

As an example - start a tinker sessions and enter camel_case('foo bar', 'baz'). It will work fine and output fooBar and just ignore baz as it only expects one argument.

Correct me if I'm wrong - I may well be missing something.

@Lloople
Copy link
Collaborator

Lloople commented Apr 23, 2018

@LKDevelopment Yeah, maybe we should create a tag just after your trait refactoring and stop 5.5 compatibility there.

I mean, maybe next releases should be >5.6 only

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.

4 participants