How to show notifications in Filament Admin Panel only (multi-panel setup) triggered by API endpoint
I'm using Laravel with Filament v3, and my app has multiple Filament panels such as Admin, Courier, etc. I want to trigger a notification in the Admin Panel only whenever the mobile app makes a POST request to the /api/orders endpoint to create a new order.
I’ve tried calling Notification::make() directly in the API controller, but it doesn’t display anything on the Admin dashboard. I’m guessing it’s because API requests don’t interact with the Filament UI directly.
Is there a proper way to trigger real-time notifications in the Filament Admin panel (but not in other panels) when an external event like an API call occurs
8 Replies
So you want to review what your doing, your asking for notifications to be per panel. But I think what you want to do is have them per use that has access to the panel? as at this time notifications are not panel specific. You could override the notifications model and add a panel into the notification class and scope them to panels if you really want to do that.
Well, per user for those who get notifications, for example user A, where user A has access to the admin panel. So, what is the method or flow for that?
Just find all users who have access to panel X, then send a notification to them.
yes I know how to find users who have access to the admin panel, but how to send a notification I use this in the controller when the api create order to the trigger
the result is the notification is not sent I checked the log there is no error, can you give me a reference?
will this Notification::make work if we put it in the Controller? because the trigger is fire?
Doesn't matter at all where the notification is triggered...
providing you sent it to the database with the user object.
okay thanks i will try it