class ExportCompletion implements ShouldQueue
{
// Truncated
public function handle(): void
{
$this->export->touch('completed_at');
if (! $this->export->user instanceof Authenticatable) {
return;
}
$failedRowsCount = $this->export->getFailedRowsCount();
Notification::make()
->title(__('filament-actions::export.notifications.completed.title'))
->body($this->exporter::getCompletedNotificationBody($this->export))
->when(
! $failedRowsCount,
fn (Notification $notification) => $notification->success(),
)
->when(
$failedRowsCount && ($failedRowsCount < $this->export->total_rows),
fn (Notification $notification) => $notification->warning(),
)
->when(
$failedRowsCount === $this->export->total_rows,
fn (Notification $notification) => $notification->danger(),
)
->when(
$failedRowsCount < $this->export->total_rows,
fn (Notification $notification) => $notification->actions(array_map(
fn (ExportFormat $format): NotificationAction => $format->getDownloadNotificationAction($this->export),
$this->formats,
)),
)
->sendToDatabase($this->export->user);
}
}
class ExportCompletion implements ShouldQueue
{
// Truncated
public function handle(): void
{
$this->export->touch('completed_at');
if (! $this->export->user instanceof Authenticatable) {
return;
}
$failedRowsCount = $this->export->getFailedRowsCount();
Notification::make()
->title(__('filament-actions::export.notifications.completed.title'))
->body($this->exporter::getCompletedNotificationBody($this->export))
->when(
! $failedRowsCount,
fn (Notification $notification) => $notification->success(),
)
->when(
$failedRowsCount && ($failedRowsCount < $this->export->total_rows),
fn (Notification $notification) => $notification->warning(),
)
->when(
$failedRowsCount === $this->export->total_rows,
fn (Notification $notification) => $notification->danger(),
)
->when(
$failedRowsCount < $this->export->total_rows,
fn (Notification $notification) => $notification->actions(array_map(
fn (ExportFormat $format): NotificationAction => $format->getDownloadNotificationAction($this->export),
$this->formats,
)),
)
->sendToDatabase($this->export->user);
}
}