›
›
›
  1. docs
  2. ›
  3. byrcsc/laravel-checklist
1.x
Browse documentationOpenClose

Getting started

  • Introduction
  • Installation and setup
  • Quick start

Core concepts

  • Templates and versions
  • Items and sections
  • Checklist lifecycle
  • Answers and evidence
  • Conditional rules
  • Scoring
  • Recurring schedules
  • Audit history

Operations

  • Author a template
  • Run a checklist
  • Create a schedule
  • Customize notifications
  • Export and report
  • Verify audit history
  • Composing with sibling packages

Reference

  • Configuration
  • Builder API
  • Models and scopes
  • Events and notifications
  • Console commands
  • Enums and contracts
  • Testing
  • Troubleshooting

Getting started

  • Introduction
  • Installation and setup
  • Quick start

Core concepts

  • Templates and versions
  • Items and sections
  • Checklist lifecycle
  • Answers and evidence
  • Conditional rules
  • Scoring
  • Recurring schedules
  • Audit history

Operations

  • Author a template
  • Run a checklist
  • Create a schedule
  • Customize notifications
  • Export and report
  • Verify audit history
  • Composing with sibling packages

Reference

  • Configuration
  • Builder API
  • Models and scopes
  • Events and notifications
  • Console commands
  • Enums and contracts
  • Testing
  • Troubleshooting

byrcsc/laravel-checklist · 1.x

Events and notifications.

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 payloads

EventPublic readonly properties
ChecklistCreatedChecklist $checklist
ChecklistAssignedChecklist $checklist, Model $assignee
ItemAnsweredChecklist $checklist, Response $response, mixed $previousValue = null, bool $wasAnsweredBefore = false
ItemFailedChecklist $checklist, Response $response
RequirementsUnmetChecklist $checklist, Response $response, array $unmet
NoteRecordedChecklist $checklist, Response $response, ?string $note, ?string $previousNote = null
EvidenceAddedChecklist $checklist, Evidence $evidence
EvidenceRemovedChecklist $checklist, deleted Evidence $evidence snapshot
VisibilityChangedChecklist $checklist, Response $response, bool $wasApplicable, bool $isApplicable
ChecklistCompletedChecklist $checklist
ChecklistReviewedChecklist $checklist, Model $reviewer, ?string $outcome
ChecklistReopenedChecklist $checklist
ChecklistDueSoonChecklist $checklist
ChecklistOverdueChecklist $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.

Shipped notification mapping

EventNotificationDefault recipients
ChecklistCreatedChecklistCreatedNotificationnone
ChecklistAssignedChecklistAssignedNotificationassignee
ItemFailedItemFailedNotificationassignee
ChecklistCompletedChecklistCompletedNotificationassignee and reviewer
ChecklistReviewedChecklistReviewedNotificationassignee
ChecklistReopenedChecklistReopenedNotificationassignee
ChecklistDueSoonChecklistDueSoonNotificationassignee
ChecklistOverdueChecklistOverdueNotificationassignee

One model filling several roles receives one notification. Null recipients and objects without Laravel's Notifiable trait are skipped.

Notification channels and payload

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.

Listening to an event

use ByRcsc\LaravelChecklist\Events\ChecklistCompleted;
use Illuminate\Support\Facades\Event;

Event::listen(ChecklistCompleted::class, function (
    ChecklistCompleted $event,
): void {
    // Queue application-specific follow-up work.
});

What to read next

  • Customize notifications to replace classes or recipient routing.
  • Audit history to see which events create action rows.
  • Testing to fake and assert events and notifications.
PreviousModels and scopesNextConsole commands
View source

On this page

  1. Event payloads
  2. Shipped notification mapping
  3. Notification channels and payload
  4. Listening to an event
  5. What to read next