Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mcalonje's avatar

Filament exporter action not showing notification when export is complete

I am trying to get spreadsheet exports to work in Filament v3 / Laravel 11, in this case for a list of institutes.

I referenced the exporter in my filament resource file for 'Institute' ( InstituteResource.php) as follows:

use Filament\Tables\Actions\ExportBulkAction;
use App\Filament\Exports\InstituteExporter;

                ExportBulkAction::make()
                    ->exporter(InstituteExporter::class)

I created the exporter (InstituteExporter.php) with automatically generated columns as follows: php artisan make:filament-exporter Product --generate

In the exporter, the following code that was automatically generated is supposed to send a notification when the export is completed, but it does not:

    public static function getCompletedNotificationBody(Export $export): string
    {
        $body = 'Your institute export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';

        if ($failedRowsCount = $export->getFailedRowsCount()) {
            $body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
        }

        return $body;
    }

When I select several records in my Institutes table in Filament, I get the bulk action option of exporting them. When I click to export them, a 'Export institutes' modal pops up allowing me to select the columns to export. When I click on export, I get a notification that says:

"Export started Your export has begun and 3 rows will be processed in the background."

However, after that, nothing else happens.

At that point, what is supposed to happen is after the export is completed, a notification bell shows up in the top right that when clicked allows the user to download a csv or excel file.

The export itself is successful, because the exports table is updated each time, and a directory is being created with the csv and excel files in public/storage/filament_exports.

The problem is that the notification for when the export is completed, allegedly referenced in the InstituteExporter.php file, does not seem to be sending the notification.

The notifications table itself is being updated when exports occur, as the 'data' field will have something like the following text:

{"actions":[{"name":"download_csv","color":null,"event":null,"eventData":[],"dispatchDirection":false,"dispatchToComponent":null,"extraAttributes":[],"icon":null,"iconPosition":"before","iconSize":null,"isOutlined":false,"isDisabled":false,"label":"Download .csv","shouldClose":false,"shouldMarkAsRead":true,"shouldMarkAsUnread":false,"shouldOpenUrlInNewTab":true,"size":"sm","tooltip":null,"url":"\/filament\/exports\/10\/download?format=csv","view":"filament-actions::link-action"},{"name":"download_xlsx","color":null,"event":null,"eventData":[],"dispatchDirection":false,"dispatchToComponent":null,"extraAttributes":[],"icon":null,"iconPosition":"before","iconSize":null,"isOutlined":false,"isDisabled":false,"label":"Download .xlsx","shouldClose":false,"shouldMarkAsRead":true,"shouldMarkAsUnread":false,"shouldOpenUrlInNewTab":true,"size":"sm","tooltip":null,"url":"\/filament\/exports\/10\/download?format=xlsx","view":"filament-actions::link-action"}],"body":"Your country name export has completed and 2 rows exported.","color":null,"duration":"persistent","icon":"heroicon-o-check-circle","iconColor":"success","status":"success","title":"Export completed","view":"filament-notifications::notification","viewData":[],"format":"filament"}

This appears to be the notification I should be getting, but for some reason I'm not receiving this notification in the filament page when the export is completed.

Any suggestions on how to resolve this issue with the 'completed' notifications for Filament exports would be greatly appreciated.

1 like
6 replies
LaryAI's avatar
Level 58

It seems like you've set up everything correctly for the export functionality in Filament, but the notification is not being displayed as expected. Here's a checklist of things you can verify and steps you can take to troubleshoot the issue:

  1. Ensure Notifications are Enabled: Make sure that notifications are enabled in your Filament configuration. You can check the Filament documentation for any specific settings related to notifications.

  2. Check Queue Worker: Since the export process is likely queued, ensure that your queue worker is running. If you're using Laravel's queue worker, you can start it with the following command:

    php artisan queue:work
    

    If the queue worker is not running, the export will be processed but the notification might not be sent.

  3. Listen for Events: Ensure that the event responsible for sending the notification is being fired. You can listen for this event in your EventServiceProvider and log some information to verify that it's being triggered.

  4. Notification Channels: Check if the notification is being sent through the correct channel. If you're expecting a database notification, ensure that the toDatabase method is properly defined in your notification class.

  5. Frontend JavaScript: Filament uses Livewire and/or Alpine.js for dynamic UI updates. Make sure that the JavaScript for these libraries is properly loaded and there are no console errors in your browser that could be preventing the notification from displaying.

  6. Clear Caches: Sometimes, cached configurations or views can cause unexpected behavior. Try clearing your application's cache with:

    php artisan optimize:clear
    
  7. Check Notification Logic: Review the logic in your InstituteExporter.php file to ensure that the notification is being created correctly. You might want to manually trigger a notification to test if it's displayed as expected.

  8. Review Notification Data: The data in the notifications table seems correct, but ensure that the notification is being marked as 'unread' so that it shows up for the user.

  9. Check User Permissions: Make sure that the user has the necessary permissions to view notifications. Filament might have permission gates that prevent certain users from seeing notifications.

  10. Debugging: Use Laravel's debugging tools such as logging or Laravel Telescope to get more insight into what's happening when the export is completed.

If after going through these steps the issue still persists, you might want to reach out to the Filament community or check the GitHub repository for any known issues or updates that could address this problem.

m1k3lm's avatar

I'm facing the same issue with Laravel 10 and filament 3.2.65

m1k3lm's avatar
m1k3lm
Best Answer
Level 1

I found what was wrong in my case. I missed to add the databaseNotification() in the app/Providers/Filament/AdminPanelProvider.php

class AdminPanelProvider extends PanelProvider
{
    public function panel(Panel $panel): Panel
    {
        return $panel
            ->default()
            ->id('admin')
            ->databaseNotifications()
            ->databaseNotificationsPolling('5s')
...
5 likes
Alberto Escamilla's avatar

@m1k3lm Que hay men, tuviste que configurar algo adicional para que se enviara la notificación a la base de datos? Este es mi codigo: ->bulkActions([ ExportBulkAction::make() ->label('EXPORTAR REGISTROS') ->exporter(MedicalReservationExporter::class) ->fileName(fn (Export $export): string => "products-{$export->getKey()}.csv"), ])

Pero en la tabla notifications, no se llena absolutamente nada.

gtresnandika's avatar

for me, i changed the QUEUE_CONNECTION=database to QUEUE_CONNECTION=sync

in .env

Please or to participate in this conversation.