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
toeknee
toeknee2y ago
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
Atena.D
Atena.DOP2y ago
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?
Dan Harrin
Dan Harrin2y ago
use a model observer? then you can do it all in one place
Atena.D
Atena.DOP2y ago
Nice idea! Thanks. 👍
toeknee
toeknee2y ago
Good shout Dan
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
toeknee
toeknee2y ago
Are you sendign them to the database?
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Dan Harrin
Dan Harrin2y ago
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 structured
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Dan Harrin
Dan Harrin2y ago
how do we render a database notification that we know nothing about?
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View

Did you find this page helpful?