Skip to content

Commit

Permalink
Merge pull request #171 from pxlrbt/feature/database-notification
Browse files Browse the repository at this point in the history
Use database notifications if enabled.
  • Loading branch information
pxlrbt authored Jan 5, 2024
2 parents aa440eb + 5df2f89 commit 83f6598
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 83f6598

Please sign in to comment.