pxlrbt/filament-excel

Excel Records - Notification

MasterAdmin2 opened this issue · 2 comments

Hello sir i am using laravel with filament's latest version and I installed your module with Composer,

now, I configured it like this on my resource page

ExportAction::make()->exports([
                ExcelExport::make('form')
                    ->except([
                        'created_at',
                        'updated_at',
                        'deleted_at',
                    ])
                    ->fromModel()
                    ->queue()
                    ->withChunkSize(500)
                    ->askForWriterType(),
            ])

now what I want is, to send a notification when the file is ready to download, but it is not saving notifications, as laravel filament provides.

so my question is, is that possible to handle it that way, so that if I come after an hour or day then i can also download the file till I haven't cleared notifications.

adding a snapshot for a better understanding

scrnli_23_12_2023_12-47-04.mp4

i solved this by adding 2 lines in 2 files, it may help

vendor/pxlrbt/filament-excel/src/Exports/ExcelExport.php
inside this file I added

Notification::make()
            ->title(__('filament-excel::notifications.queued.title'))
            ->body(__('filament-excel::notifications.queued.body'))
            ->icon('heroicon-o-arrow-down-tray')
            ->success()
            ->sendToDatabase(auth()->user())
            ->send();`

and inside this file
vendor/pxlrbt/filament-excel/src/FilamentExcelServiceProvider.php
I added

Notification::make(data_get($export, 'id'))
                ->title(__('filament-excel::notifications.download_ready.title'))
                ->body(__('filament-excel::notifications.download_ready.body'))
                ->success()
                ->icon('heroicon-o-arrow-down-tray')
                ->actions([
                    Action::make('download')
                        ->label(__('filament-excel::notifications.download_ready.download'))
                        ->url($url, shouldOpenInNewTab: true)
                        ->button()
                        ->close(),
                ])
                ->sendToDatabase(auth()->user());

If possible can you implement it in master so that it will be verified by you whenever we run an update update it will be present, and I am pretty sure, everyone will like this.

Closing as duplicate of #108