Action with Notification not showing

Dealing with a small issue where notification isn't appearing. I have a header action that launches a job. When I confirm the action, it returns to the index and nothing happens. No indication that it was successfully started. Any ideas?
Action::make('sync_bigcommerce_products')
->label('Sync with BigCommerce')
->icon('heroicon-o-arrow-path')
->requiresConfirmation()
->successNotification(
Notification::make()
->success()
->title('Sync Started')
->body('The sync with BigCommerce has started - this may take a few minutes.')
)
->action(fn () => SyncBigcommerceProductsJob::dispatch())
Action::make('sync_bigcommerce_products')
->label('Sync with BigCommerce')
->icon('heroicon-o-arrow-path')
->requiresConfirmation()
->successNotification(
Notification::make()
->success()
->title('Sync Started')
->body('The sync with BigCommerce has started - this may take a few minutes.')
)
->action(fn () => SyncBigcommerceProductsJob::dispatch())
2 Replies
ahinkle
ahinkleOP2mo ago
Solved with a little tweaking of the action method:
Action::make('sync_bigcommerce_products')
->label('Sync with BigCommerce')
->icon('heroicon-o-arrow-path')
->requiresConfirmation()
->action(function () {
SyncBigcommerceProductsJob::dispatch();
Notification::make()
->success()
->title('Sync Started')
->body('The sync with BigCommerce has started - this may take a few minutes.')
->send();
})
Action::make('sync_bigcommerce_products')
->label('Sync with BigCommerce')
->icon('heroicon-o-arrow-path')
->requiresConfirmation()
->action(function () {
SyncBigcommerceProductsJob::dispatch();
Notification::make()
->success()
->title('Sync Started')
->body('The sync with BigCommerce has started - this may take a few minutes.')
->send();
})
Matthew
Matthew2mo ago
From your original, you're missing the ->send(). That was the only change needed.
Want results from more Discord servers?
Add your server