momostafa
momostafa
FFilament
Created by momostafa on 7/14/2024 in #❓┊help
How to save Reverb Broadcasted notifications to database?
after some trial and errors as the documentation doesn't clearly point out to it this is how I have implemented it
$title = $data['title'];
$message = $data['message'];
$url = $data['url'];
$user = User::find($data['user_id']);

Notification::make()
->success()
->title($title)
->body($message)
//->persistent()
->actions([
Action::make('View')
->button()
->url($url, shouldOpenInNewTab: true),
])
->broadcast($user)
//queue:listen or queue:work should be running so that the notification will be displayed under the notifications modal panel (Bell Icon)
->sendToDatabase($user)
->send();
// use instead of database polling
event(new DatabaseNotificationsSent($user));
$title = $data['title'];
$message = $data['message'];
$url = $data['url'];
$user = User::find($data['user_id']);

Notification::make()
->success()
->title($title)
->body($message)
//->persistent()
->actions([
Action::make('View')
->button()
->url($url, shouldOpenInNewTab: true),
])
->broadcast($user)
//queue:listen or queue:work should be running so that the notification will be displayed under the notifications modal panel (Bell Icon)
->sendToDatabase($user)
->send();
// use instead of database polling
event(new DatabaseNotificationsSent($user));
4 replies
FFilament
Created by momostafa on 7/14/2024 in #❓┊help
How to save Reverb Broadcasted notifications to database?
Thanks a lot for your response, yes that worked perfectly thank you so much 👍
4 replies