F
Filament•7mo ago
NolanN

Database notifications not showing in panel

I added database notifications to one of my panels and I see the icon and I get the slide over. I also configured a toDatabase method on the Laravel notification I had created. I see it getting stored in the DB and it is linked to the correct model but nothing is showing in the user interface. Any ideas?
9 Replies
christmex
christmex•7mo ago
maybe some screenshot or screen recording or some code so we can understand more 😉
awcodes
awcodes•7mo ago
Try changing QUEUE_CONNECTION in your .env from ‘database’ to 'sync’
NolanN
NolanNOP•7mo ago
I already had my QUEUE_CONNECTION set to sync I've added ->databaseNotifications() on my panel and I see the icon as expected. My Laravel notification has database specified as one of the channels and I've also added a toDatabase method:
public function via(object $notifiable): array
{
return ['database', 'mail'];
}

public function toDatabase(object $notifiable): array
{
return FilamentNotification::make()
->title('Saved successfully')
->getDatabaseMessage();
}
public function via(object $notifiable): array
{
return ['database', 'mail'];
}

public function toDatabase(object $notifiable): array
{
return FilamentNotification::make()
->title('Saved successfully')
->getDatabaseMessage();
}
NolanN
NolanNOP•7mo ago
Here is what I see in the DB after the notification is sent. I am logged in as the correct customer as well.
No description
NolanN
NolanNOP•7mo ago
Does Filament only show notifications that are directly associated to the user that is logged in? I was thinking that it would work for my Customer model which acts like a team
Dennis Koch
Dennis Koch•7mo ago
Does Filament only show notifications that are directly associated to the user that is logged in?
I guess that's the default behaviour.
NolanN
NolanNOP•7mo ago
I'm thinking this could be a good PR for me to work on. I haven't tried to contribute before so I'm just curious if I could get some input on whether y'all think this would be a helpful addition for the framework before I work on it. I'm thinking users would get access to something like ->setNotifiableModel() or ->getNotifiableUsing().
Dennis Koch
Dennis Koch•7mo ago
Not sure whether that would help in that case. Wouldn’t you still want notifications per user not only per team?
NolanN
NolanNOP•7mo ago
I had been thinking that it would be good to avoid sending a notification to each member of the team but I suppose that I would still need to have notifications on the user level in case they are creating exports or something similar
Want results from more Discord servers?
Add your server