Custom notifications service provider clarification
Hi everyone, I've created a custom notification view and I'm trying to send a custom notification in a CreateResource inside the
create()
function.
I'm confused about where to include Notification::configureUsing()
. It's mentioned in the documentation that it should be included in a service provider but I'm not sure where exactly since I want to only show it in a specific CreateResource page.
Any clarification would be greatly appreciated.4 Replies
You don’t need that one if you don’t want global configuration. Just set the view on the notification itself.
Thanks for the reply @Dennis Koch. Unfortunately, it's not working for some reason.
The following code overrides the default view ands works fine when added to a service provider.
But using the following has no effect at all, and the notification renders the default view.
Am I doing something wrong?
Hm. I guess the issue is, that the view isn’t stored in the notification. So on the next page load when the notification is rendered to information is lost
Notification
inherits from ViewComponent
which has a $view
property. I've tried to create a class that inherits from Notification
and override $view
but again, the notification renders the default view. I'll move on to something else now but in case anyone knows a way to render a custom view in a specific notification, please let me know. Thanks @Dennis Koch.