Skip to content

Commit 805de5a

Browse files
authored
Merge pull request #79 from pxlrbt/fix/persisted-notification
Fix duplicated notification
2 parents 88b191e + 64588ec commit 805de5a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/FilamentExcelServiceProvider.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Illuminate\Support\Facades\Storage;
1212
use Illuminate\Support\Facades\URL;
1313
use Illuminate\Support\ServiceProvider;
14+
use Illuminate\Support\Str;
1415
use pxlrbt\FilamentExcel\Commands\PruneExportsCommand;
1516
use pxlrbt\FilamentExcel\Events\ExportFinishedEvent;
1617

@@ -63,7 +64,7 @@ public function sendExportFinishedNotification()
6364
continue;
6465
}
6566

66-
Notification::make()
67+
Notification::make(data_get($export, 'id'))
6768
->title(__('filament-excel::notifications.download_ready.title'))
6869
->body(__('filament-excel::notifications.download_ready.body'))
6970
->success()
@@ -89,7 +90,11 @@ public function cacheExportFinishedNotification(ExportFinishedEvent $event)
8990
$key = $this->getNotificationCacheKey($event->userId);
9091

9192
$exports = cache()->pull($key, []);
92-
$exports[] = ['filename' => $event->filename, 'userId' => $event->userId];
93+
$exports[] = [
94+
'id' => Str::uuid(),
95+
'filename' => $event->filename,
96+
'userId' => $event->userId
97+
];
9398

9499
cache()->put($key, $exports);
95100
}

0 commit comments

Comments
 (0)