Files
L-Ami-Fiduciaire/app/Notifications/DeclarationMentionNotification.php
Saad Zoubir 8f39bd9b73 fix: resolve permission toggle persistence, nudge terminology, and bulk action bugs (Bugs #2-5)
- Fix togglePermission() to always include all permission keys with false defaults
- Add migration to backfill null/empty Manager permissions with config defaults
- Rename nudge UI text from "Relance" to "Notification"/"Notifier" across 8 files
- Fix select-all checkbox and show checkboxes on all declaration rows
- Remove en_attente_client status restriction from BulkNotificationController

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

60 lines
1.8 KiB
PHP

<?php
namespace App\Notifications;
use App\Enums\NotificationType;
use App\Models\Declaration;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class DeclarationMentionNotification extends Notification implements ShouldQueue
{
use Queueable;
public function __construct(
public Declaration $declaration,
public User $mentionedBy,
public string $message,
) {}
/**
* @return array<string>
*/
public function via(object $notifiable): array
{
return ['database', 'mail'];
}
/**
* @return array<string, mixed>
*/
public function toDatabase(object $notifiable): array
{
return [
'workspace_id' => $this->declaration->workspace_id,
'notification_type' => NotificationType::Mention,
'declaration_id' => $this->declaration->id,
'declaration_title' => $this->declaration->title,
'mentioned_by_id' => $this->mentionedBy->id,
'mentioned_by_name' => $this->mentionedBy->name,
'message' => $this->message,
'url' => route('declarations.show', $this->declaration),
];
}
public function toMail(object $notifiable): MailMessage
{
return (new MailMessage)
->subject('Vous avez été mentionné - '.$this->declaration->title)
->markdown('emails.declaration-mention', [
'declarationTitle' => $this->declaration->title,
'mentionedByName' => $this->mentionedBy->name,
'message' => $this->message,
'url' => route('declarations.show', $this->declaration),
]);
}
}