Clear Notification after Button Clicked
Is it possible to clear a specific database notification by clicking an action button?
22 Replies
You can technically just delete the notification directly so no need to clear?
How to access current notification within the Action?
So you want to add a button to the popup notification to clear it?
Yes
Not Popup but Database Notification
But database notifications have an X to them to remove it?
this?
This will close the modal. I want to delete it from the db.
Where are you trying to do it?
From the Notification Modal
Do you have the notification id?
Let me show you a little bit of code.
I guess you can use in the action
->dispatch('notificationClosed', ['id' => 'notificationid'])
If I click on clear, it deletes all notifications for the user. I want to delete only a specific notification after Download button is clicked
Solution
'x-on:click' => 'close'
will delete the notification I guess. Try itPerfect. How did you came to know about this? I mean where to look in docs etc.
The Filament docs are awesome, but sometimes we gotta dive into the source code to get things done.
can we totally remove clear button. ?
You can use CSS, but if you are not purging them I would advise against it.
I don't want user to clear their notifications . Just mark as read only..
which is bad if they have 400 notifications you'll end up with browser slow downs.
But if user mark as read, filament won't fetch it correct?
Yes it will, it shows all notifications in the notification modal.