Certified/app/Notifications/CertificateExpiringNotification.php
Joël van de Wouw ac340d125c
Some checks failed
linter / quality (push) Failing after 13s
tests / ci (8.3) (push) Failing after 2s
tests / ci (8.4) (push) Failing after 2s
tests / ci (8.5) (push) Failing after 3s
Initial commit
Certificate manager built on Laravel 13, Livewire 4, and Flux.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-12 14:44:58 +02:00

39 lines
1.2 KiB
PHP

<?php
namespace App\Notifications;
use App\Models\Certificate;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class CertificateExpiringNotification extends Notification
{
use Queueable;
public function __construct(public Certificate $certificate) {}
/**
* @return array<int, string>
*/
public function via(object $notifiable): array
{
return ['mail'];
}
public function toMail(User $notifiable): MailMessage
{
$date = $this->certificate->expires_at->toFormattedDateString();
return (new MailMessage)
->subject(__('Certificate expiring soon: :title', ['title' => $this->certificate->title]))
->greeting(__('Hello :name,', ['name' => $notifiable->name]))
->line(__('Your certificate ":title" will expire on :date.', [
'title' => $this->certificate->title,
'date' => $date,
]))
->action(__('View your certificates'), route('certificates.index'))
->line(__('Please renew it in good time to stay compliant.'));
}
}