›
›
›
  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

Customize notifications.

Disable, replace, reword, or reroute the shipped checklist notifications without disabling domain events.

The package maps eight domain events to mail and database notifications. Change that mapping when the shipped messages, recipients, or channels do not fit your application. Domain events continue to dispatch when you disable the notifications.

Disable every shipped notification

CHECKLIST_NOTIFICATIONS=false

This leaves events and audit recording active. Choose this setting when your application listeners own all delivery.

Silence or replace one event

Publish the configuration, then add overrides:

use App\Notifications\ChecklistOverdueNotification;
use ByRcsc\LaravelChecklist\Events\ChecklistCreated;
use ByRcsc\LaravelChecklist\Events\ChecklistOverdue;

'notifications' => [
    'enabled' => true,
    'recipient_resolver' => App\Checklists\RecipientResolver::class,
    'classes' => [
        ChecklistCreated::class => null,
        ChecklistOverdue::class => ChecklistOverdueNotification::class,
    ],
],

A missing key uses the shipped class. A key mapped to null sends nothing for that event. A replacement must extend Laravel's Notification class and accept the checklist through its container construction.

Route recipients through one contract

namespace App\Checklists;

use ByRcsc\LaravelChecklist\Contracts\RecipientResolver as Contract;
use ByRcsc\LaravelChecklist\Models\Checklist;

final class RecipientResolver implements Contract
{
    public function resolve(string $event, Checklist $checklist): iterable
    {
        return array_filter([
            $checklist->assignedTo,
            $checklist->subject?->manager,
        ]);
    }
}

Set this class in checklist.notifications.recipient_resolver. Returned values without Laravel's Notifiable trait are skipped. Duplicate Eloquent models are sent one notification even if they fill several roles.

The default resolver sends assigned, failed, due-soon, overdue, and reopened messages to the assignee. Completion goes to assignee and reviewer. Review goes to the assignee. Creation has no default recipient.

Change wording without replacing classes

php artisan vendor:publish --tag="checklist-translations"

Edit the published notifications.php language file. Each shipped class reads its subject, greeting, body, and template line from these translations.

Add another channel

Extend ChecklistNotification, implement its protected key(), and override via() and the relevant channel method:

final class ChecklistOverdueNotification extends ChecklistNotification
{
    protected function key(): string
    {
        return 'overdue';
    }

    public function via(mixed $notifiable): array
    {
        return ['database', 'slack'];
    }
}

Map the event to the class in configuration.

What to read next

  • Events and notifications for the full mapping and event payloads.
  • Configuration for notification keys and defaults.
  • Testing to fake events, notifications, and evidence storage.
PreviousCreate a scheduleNextExport and report
View source

On this page

  1. Disable every shipped notification
  2. Silence or replace one event
  3. Route recipients through one contract
  4. Change wording without replacing classes
  5. Add another channel
  6. What to read next