Send database notification for any change in a table.
Hi. I wanted to know how can I send database notification to admin panel whenever one of my table changes e.g. one record deleted, added or created. I read https://filamentphp.com/docs/2.x/notifications/database-notifications but I was just able to add the notification bell to admin panel and I couldn't listen to database changes
Filament
Database notifications - Notifications - Filament
Elegant TALL stack notifications for Laravel artisans.
12 Replies
I am not sure I follow? The docs explain it, so when you delete you need to send the notification with sendToDatabase().
Ensure you have polling enabled if you want them to show to the user without refreshing the page
should I use Notification::make() whenever an update, delete or create happened? I mean is there any way that I can listen for them instead of adding the same line of code in each of them?
use a model observer?
then you can do it all in one place
Nice idea! Thanks. π
Good shout Dan
Unknown Userβ’2y ago
Message Not Public
Sign In & Join Server To View
Are you sendign them to the database?
Unknown Userβ’2y ago
Message Not Public
Sign In & Join Server To View
the data is wrong
i guess you didnt send the database notification using filament?
you need to use our
Notification::make()
api otherwise the data isnt structuredUnknown Userβ’2y ago
Message Not Public
Sign In & Join Server To View
how do we render a database notification that we know nothing about?
Unknown Userβ’2y ago
Message Not Public
Sign In & Join Server To View