Installing database notifications on existing project

I'm trying to do that but I see that I don't have any assets published in my views directory and only javascript assets are published. I have checked in vendor/filament/notifications/views and there are still many assets that have not been published. Also, in the documentation it mentions that the view must be registered in a Service Provider, but it doesn't mention in which one, I tried to do it in the AppServiceProvider but it doesn't work because it shows the error "Undefined variable $unreadNotificationsCount". Someone please guide me :S
14 Replies
Altffenser
AltffenserOP14mo ago
This in Filament v3
krekas
krekas14mo ago
you are trying to add notification not in a panel right?
Altffenser
AltffenserOP14mo ago
Right
krekas
krekas14mo ago
just checked the installation part in the docs and it doesn't mention anything about provider
Altffenser
AltffenserOP14mo ago
Says: In the service provider, point to this new trigger view: use Filament\Notifications\Livewire\DatabaseNotifications; DatabaseNotifications::trigger('filament-notifications.database-notifications-trigger');
krekas
krekas14mo ago
well first thing you shouldn't publish views if I remember correctly just adding @livewire('database-notifications') should work
cheesegrits
cheesegrits14mo ago
In the boot() method of your AppServiceProvider ...
DatabaseNotifications::trigger('notifications.database-notifications-trigger');
DatabaseNotifications::pollingInterval('60s');
DatabaseNotifications::trigger('notifications.database-notifications-trigger');
DatabaseNotifications::pollingInterval('60s');
This assumes you followed the instructions and created your trigger view in the correct place. And you don't need the pollingInterval, that's just what I happen to do.
Altffenser
AltffenserOP14mo ago
When do it, show me this View [filament-notifications.database-notifications-trigger] not found.
awcodes
awcodes14mo ago
'filament-notifications.database-notifications-trigger' is an example. you have to actually create the view in your app
Altffenser
AltffenserOP14mo ago
No description
cheesegrits
cheesegrits14mo ago
Why is it in livewire? /resources/views/notifications/database-notifications-trigger.blade.php
Altffenser
AltffenserOP14mo ago
Is not in Livewire foilder Folder* Now is working Guys!
cheesegrits
cheesegrits14mo ago
🥳
Altffenser
AltffenserOP14mo ago
Thank you so much! The problem: my folder is "notifications" not "filament-Notifications" haha
Want results from more Discord servers?
Add your server