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

How to use shorthand notation 'webpush' for the channel name in the via() method? #164

Open
boryn opened this issue Jul 13, 2021 · 1 comment

Comments

@boryn
Copy link

boryn commented Jul 13, 2021

I'd like to return ['webpush'] in the via() method instead of WebPushChannel::class.

I based on https://medium.com/@sirajul.anik/laravel-notifications-part-2-creating-a-custom-notification-channel-6b0eb0d81294 and tried to register it in the AppServiceProvider.php with:

Notification::extend('webpush', function ($app) {
    return new WebPushChannel();
});

but WebPushChannel() constructor needs additional parameters and this method fails.

@imrodrigoalves
Copy link

Hello,
Have you tried resolving the WebPushChannel from the container?

return $app->make(WebPushChannel::class);

Using this you delegate the responsability to the container.

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

No branches or pull requests

2 participants