Files
L-Ami-Fiduciaire/app/Mail/NudgeNotificationMail.php
Saad Zoubir 1ab3cfc445 feat: add notification infrastructure with database channel, enum, and notification classes (Story 3.1)
Set up Laravel notification system with NotificationType enum (5 types),
NudgeNotification, DocumentUploadedNotification, and DeclarationOverdueNotification
classes with database + mail channels. Add email templates, infrastructure tests,
and fix existing NotificationController tests for workspace compatibility.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 11:26:03 +01:00

44 lines
1.2 KiB
PHP

<?php
namespace App\Mail;
use App\Models\Declaration;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
class NudgeNotificationMail extends Mailable
{
use Queueable, SerializesModels;
public function __construct(
public Declaration $declaration,
public User $sender,
) {}
public function envelope(): Envelope
{
return new Envelope(
subject: 'Relance - '.($this->declaration->title ?? 'Sans titre'),
);
}
public function content(): Content
{
return new Content(
markdown: 'emails.nudge-notification',
with: [
'senderName' => $this->sender->name,
'clientName' => $this->declaration->client?->name,
'declarationType' => $this->declaration->type?->value,
'dueDate' => $this->declaration->due_date?->format('d/m/Y'),
'url' => route('declarations.show', $this->declaration),
'firmName' => $this->declaration->workspace?->name,
]
);
}
}