Certificate manager built on Laravel 13, Livewire 4, and Flux. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
39 lines
1.2 KiB
PHP
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.'));
|
|
}
|
|
}
|