add $notificationId to every broadcast notification

This commit is contained in:
2026-03-19 18:22:36 +01:00
parent 9fbc09017b
commit 2252ac9547
2 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -100,7 +100,7 @@ class EventsController extends Controller
if (Carbon::now()->lessThanOrEqualTo($event->end)) { if (Carbon::now()->lessThanOrEqualTo($event->end)) {
$notification = Notification::create([ $notification = Notification::create([
'content' => "L'événement '{$event->name}' a été supprimé. Vous n'y participez donc plus." 'content' => "L'événement {$event->name} a été supprimé. Vous n'y participez donc plus."
]); ]);
$notification->users()->attach($participants->pluck('id')); $notification->users()->attach($participants->pluck('id'));
+4 -4
View File
@@ -32,7 +32,7 @@ class TasksController extends Controller
try { try {
$event = Event::find($request["events_id"]); $event = Event::find($request["event_id"]);
$event->tasks()->create([ $event->tasks()->create([
"name" => $request["name"], "name" => $request["name"],
@@ -94,9 +94,9 @@ class TasksController extends Controller
} }
$user = User::find($id); $user = User::find($id);
$task->users()->attach($id);
if($user && Carbon::now()->lessThanOrEqualTo($task->end)) { if($user && Carbon::now()->lessThanOrEqualTo($task->end)) {
$task->users()->attach($id);
$notification = Notification::create([ $notification = Notification::create([
'content' => "Vous avez été assigné à la tâche {$task->name} de l'événement {$event->name}." 'content' => "Vous avez été assigné à la tâche {$task->name} de l'événement {$event->name}."
@@ -162,7 +162,7 @@ class TasksController extends Controller
if (Carbon::now()->lessThanOrEqualTo($task->end)) { if (Carbon::now()->lessThanOrEqualTo($task->end)) {
if ($participants->isNotEmpty()) { if ($participants->isNotEmpty()) {
$notification = Notification::create([ $notification = Notification::create([
'content' => "La tâche '{$task->name}' pour l'événement '{$event->name}' a été supprimée. Vous n'y participez donc plus." 'content' => "La tâche {$task->name} pour l'événement {$event->name} a été supprimée. Vous n'y participez donc plus."
]); ]);
$notification->users()->attach($participants->pluck('id')); $notification->users()->attach($participants->pluck('id'));
} }
@@ -298,9 +298,9 @@ class TasksController extends Controller
} }
$user = User::find($id); $user = User::find($id);
$task->users()->detach($id);
if ($user && Carbon::now()->lessThanOrEqualTo($task->end)) { if ($user && Carbon::now()->lessThanOrEqualTo($task->end)) {
$task->users()->detach($id);
$notification = Notification::create([ $notification = Notification::create([
'content' => "Vous avez été désassigné de la tâche {$task->name} de l'événement {$event->name}." 'content' => "Vous avez été désassigné de la tâche {$task->name} de l'événement {$event->name}."
]); ]);