Overview
Opscale\NotificationCenter\Nova\Actions\PublishNotification is a Laravel Nova action available on the Notification resource detail view. It transitions a notification from Draft to Published, attaches a selected audience, and immediately dispatches ExecuteNotificationStrategy to begin channel delivery.
Class signature
Availability
| Property | Value |
|---|---|
$onlyOnDetail | true — the action is only shown on the Notification detail page, not on index views |
| Resource | Notification |
Action fields
The ID of the
Audience to attach to the notification. The select options are populated from all audiences in the database (Audience::pluck('name', 'id')).Validation rules: required.Helper text: “Select the audience to send the notification to.”What happens when the action runs
Validate the audience
The action retrieves the audience by the submitted
audience_id. If the audience does not exist, it returns an error banner:Attach the audience
The chosen audience is associated with the notification via the pivot relationship:
Dispatch the strategy job
ExecuteNotificationStrategy is dispatched for the notification. The job will iterate over all profiles in the attached audience and begin the configured channel delivery sequence:handle method signature
The submitted form fields. Provides
audience_id via $fields->get('audience_id').The collection of
Notification models selected in the Nova UI. Each model is published and dispatched individually.Status transitions
| Before | After |
|---|---|
Draft | Published |
Usage in Nova
Register the action on your Notification Nova resource:Because
$onlyOnDetail is true, the action does not appear in bulk-action menus on the notification index. It can only be triggered from an individual notification’s detail view.