Skip to content

Commit

Permalink
Use database notifications if enabled.
Browse files Browse the repository at this point in the history
  • Loading branch information
pxlrbt committed Jan 5, 2024
1 parent aa440eb commit 5df2f89
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions src/FilamentExcelServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ public function sendExportFinishedNotification(): void
continue;
}

Notification::make(data_get($export, 'id'))
if (Filament::getCurrentPanel()->hasDatabaseNotifications()) {
Notification::make(data_get($export, 'id'))
->title(__('filament-excel::notifications.download_ready.title'))
->body(__('filament-excel::notifications.download_ready.body'))
->success()
Expand All @@ -76,10 +77,24 @@ public function sendExportFinishedNotification(): void
->label(__('filament-excel::notifications.download_ready.download'))
->url($url, shouldOpenInNewTab: true)
->button()
->close(),
])
->persistent()
->send();
->sendToDatabase(auth()->user());
} else {
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(),
])
->persistent()
->send();
}
}
}

Expand Down

0 comments on commit 5df2f89

Please sign in to comment.