Add notification-level deduplication keys and TTLs for deployment, backup, server, container, scheduled task, SSL, token, and transactional emails. Apply deduplication in email channels before sending rendered messages.
33 lines
625 B
PHP
33 lines
625 B
PHP
<?php
|
|
|
|
namespace App\Notifications;
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Notifications\Notification;
|
|
|
|
class CustomEmailNotification extends Notification implements ShouldQueue
|
|
{
|
|
use Queueable;
|
|
|
|
public $backoff = [10, 20, 30, 40, 50];
|
|
|
|
public $tries = 5;
|
|
|
|
public $maxExceptions = 5;
|
|
|
|
public function shouldDeduplicate(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function deduplicateFor(): int
|
|
{
|
|
return 900;
|
|
}
|
|
|
|
public function deduplicationKey(object $notifiable, string $channel): ?string
|
|
{
|
|
return null;
|
|
}
|
|
}
|