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>
This commit is contained in:
43
app/Mail/NudgeNotificationMail.php
Normal file
43
app/Mail/NudgeNotificationMail.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?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,
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user