›
byrcsc/laravel-checklist · 1.x
Reference every after-commit domain event, payload, shipped notification, and default recipient.
The package dispatches a domain event for every state change your application can react to. The notification dispatcher listens to eight of them, and the audit recorder listens to the state-changing events it records.
Every event implements ShouldDispatchAfterCommit.
| Event | Public readonly properties |
|---|---|
ChecklistCreated | Checklist $checklist |
ChecklistAssigned | Checklist $checklist, Model $assignee |
ItemAnswered | Checklist $checklist, Response $response, mixed $previousValue = null, bool $wasAnsweredBefore = false |
ItemFailed | Checklist $checklist, Response $response |
RequirementsUnmet | Checklist $checklist, Response $response, array $unmet |
NoteRecorded | Checklist $checklist, Response $response, ?string $note, ?string $previousNote = null |
EvidenceAdded | Checklist $checklist, Evidence $evidence |
EvidenceRemoved | Checklist $checklist, deleted Evidence $evidence snapshot |
VisibilityChanged | Checklist $checklist, Response $response, bool $wasApplicable, bool $isApplicable |
ChecklistCompleted | Checklist $checklist |
ChecklistReviewed | Checklist $checklist, Model $reviewer, ?string $outcome |
ChecklistReopened | Checklist $checklist |
ChecklistDueSoon | Checklist $checklist |
ChecklistOverdue | Checklist $checklist |
VisibilityChanged::becameNotApplicable(): bool reports the direction of a
flip.
ItemFailed accompanies ItemAnswered when the shared type-handler predicate
reports a score of exactly zero. RequirementsUnmet reports an accepted answer
that still needs a note or evidence.
| Event | Notification | Default recipients |
|---|---|---|
ChecklistCreated | ChecklistCreatedNotification | none |
ChecklistAssigned | ChecklistAssignedNotification | assignee |
ItemFailed | ItemFailedNotification | assignee |
ChecklistCompleted | ChecklistCompletedNotification | assignee and reviewer |
ChecklistReviewed | ChecklistReviewedNotification | assignee |
ChecklistReopened | ChecklistReopenedNotification | assignee |
ChecklistDueSoon | ChecklistDueSoonNotification | assignee |
ChecklistOverdue | ChecklistOverdueNotification | assignee |
One model filling several roles receives one notification. Null recipients and
objects without Laravel's Notifiable trait are skipped.
Every shipped class extends ChecklistNotification and returns mail and
database from via().
The database payload contains:
[
'event' => 'assigned',
'checklist_id' => $checklist->id,
'template_version_id' => $checklist->template_version_id,
'template' => 'Vehicle inspection',
'status' => 'pending',
'due_at' => $checklist->due_at?->toIso8601String(),
'message' => '...',
]Delivery failures are reported through Laravel's exception handler and do not undo the checklist operation that triggered them.
use ByRcsc\LaravelChecklist\Events\ChecklistCompleted;
use Illuminate\Support\Facades\Event;
Event::listen(ChecklistCompleted::class, function (
ChecklistCompleted $event,
): void {
// Queue application-specific follow-up work.
});