Laravel 11 Filament 3 database notification Not save Data
I'm using Livewire on the frontend page. When a client sends an email via the contact us form, I want to receive a notification. Here's the code I'm using
public function SendEmailVia()
{
code......
and
Notification::make() ->title('You have a new message 😊') ->success() ->body('Requester: ' . $this->name) ->actions([ Action::make('markAsRead') ->label('Mark as Read') ->button() ->markAsRead(), ]) ->sendToDatabase(User::all()); } However, the notification isn't saving the data, and no errors are appearing. The notification is being sent, but the data isn't being saved.
Notification::make() ->title('You have a new message 😊') ->success() ->body('Requester: ' . $this->name) ->actions([ Action::make('markAsRead') ->label('Mark as Read') ->button() ->markAsRead(), ]) ->sendToDatabase(User::all()); } However, the notification isn't saving the data, and no errors are appearing. The notification is being sent, but the data isn't being saved.
Solution:Jump to solution
I have created a new project Filament, and it works fine. Thank you for helping me out. and the notifications works fine
18 Replies
Hi... Queue is running ?
The notification is being sent, but the data isn't being saved.What do you mean by "data isn't being saved"? Which data?
->sendToDatabase(User::all());This sends the notification to all you users.
Would you please see the video record for the problem?
i am using livewire 3.4 and filament 3.2.71 and laravel 11
i am using livewire 3.4 and filament 3.2.71 and laravel 11
Do you mean, notification polling?
https://filamentphp.com/docs/3.x/panels/notifications/#overview
- Is your queue running? As BBB pointed out?
- Is
Admin
the same model you use as user model for the panel?
- What does the notifications
table look like in your DB?1-No, it is not running .
2- Yes,it is
no , as you can see the video i sent message but the the notification isn't saving the data
1. So did you try starting the queue worker?
3. So no notifications?Ah I see "total 0"
i made php artisan queue:work or php artisan queue:listen . I got the notification but the notification table is null
But now you have 1 notification?
Yes , but the notification table is null
That's weird. Are you sure that's the right DB etc? But the problem "no notifications" is fixed, right?
i am sure , iam using the right database .
Yes.it is the notifications" not fixed
Yes.it is the notifications" not fixed
I'm having the same issue. Notifications not saving the the database table. My laravel project has been upgraded to laravel 10. Filament and livewire upgraded from 2 to 3
looks like my queue driver was set to database but i didn't have a worker running. after changing to sync it inserted the notification into the table.
Solution
I have created a new project Filament, and it works fine. Thank you for helping me out. and the notifications works fine