Database Notifications trigger button not rendered

I'm following the instructions to set up database notifications. I added the blade to my layout file:
<body class="antialiased">
@livewire('notifications')
@livewire('database-notifications')

{{ $slot ?? '' }}
@yield('content')


@filamentScripts
@vite('resources/js/app.js')
</body>
<body class="antialiased">
@livewire('notifications')
@livewire('database-notifications')

{{ $slot ?? '' }}
@yield('content')


@filamentScripts
@vite('resources/js/app.js')
</body>
I added this to a new blade file in resources/views/notifications/database-notifications-trigger.blade.php:
<button type="button">
Notifications ({{ $unreadNotificationsCount }} unread)
</button>
<button type="button">
Notifications ({{ $unreadNotificationsCount }} unread)
</button>
I added this to the boot method of my AppServiceProvider:
DatabaseNotifications::trigger('notifications.database-notifications-trigger');
DatabaseNotifications::trigger('notifications.database-notifications-trigger');
The trigger button isn't rendered in my view.
Solution:
ok, apparently you also have to add some lines to the panel provider, which I didn't see in the docs. ``` ->databaseNotifications() ->databaseNotificationsPolling('30s');...
Jump to solution
4 Replies
Dennis Koch
Dennis Koch13mo ago
Can you explain what you refer to? What's the trigger that should be rendered? Ah, found it on the docs.
Jon Mason
Jon MasonOP13mo ago
just realized it's showing up on the admin panel, but not on my "app" panel..
Solution
Jon Mason
Jon Mason13mo ago
ok, apparently you also have to add some lines to the panel provider, which I didn't see in the docs.
->databaseNotifications()
->databaseNotificationsPolling('30s');
->databaseNotifications()
->databaseNotificationsPolling('30s');
Jon Mason
Jon MasonOP13mo ago
probably the polling is optional, but I got it working by adding this.
Want results from more Discord servers?
Add your server