F
Filament12mo ago
Daniel

Broadcasting after export completed

Is there a way to broadcast the notification to the user when export is done? Broadcasting is running already and want to have this in addition to the database notification but don't know where to implement it.
8 Replies
bwurtz999
bwurtz99912mo ago
You can probably broadcast using render hooks (https://filamentphp.com/docs/3.x/support/render-hooks) to inject the proper frontside JS
Daniel
DanielOP12mo ago
broadcasting is already working
bwurtz999
bwurtz99912mo ago
Can I ask why you want database notifications and broadcasting? It feels like a lot of extra work for the same result
Daniel
DanielOP12mo ago
filaments new built-in export is sending databsse notifications after export has been completed but i also want a broadcast message as some users might not notice the small notification (bell) in header after their export is ready to download
bwurtz999
bwurtz99912mo ago
got it So you mean the page is properly receiving the broadcast, and now you want to display the notification?
Daniel
DanielOP12mo ago
no, i mean that filament already supports broadcasting (i've tested it with tinker) but i don't know how i can get the built-in export action sending a broadcast notification (in addition to the database notification) something like this (from my tinker test):
$user = User::find(1);

$notification = Notification::make()
->title('Test 123')
->success()
->sendToDatabase($user)
->broadcast($user);
$user = User::find(1);

$notification = Notification::make()
->title('Test 123')
->success()
->sendToDatabase($user)
->broadcast($user);
bwurtz999
bwurtz99912mo ago
Oh I get it now Yeah it doesn't look like there's a direct option to customize that
bwurtz999
bwurtz99912mo ago
GitHub
filament/packages/actions/src/Exports/Jobs/PrepareCsvExport.php at ...
A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS. - filamentphp/filament

Did you find this page helpful?