From 2dcc861317d268fae21d47fcadea1455d54dd57b Mon Sep 17 00:00:00 2001 From: Giovanni-Josserand Date: Thu, 12 Mar 2026 09:38:58 +0100 Subject: [PATCH] create notification on delete event --- app/Http/Controllers/EventsController.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/Http/Controllers/EventsController.php b/app/Http/Controllers/EventsController.php index b26b49e..ca419e6 100644 --- a/app/Http/Controllers/EventsController.php +++ b/app/Http/Controllers/EventsController.php @@ -4,6 +4,7 @@ namespace App\Http\Controllers; use App\Events\EventParticipationCancelled; use App\Models\Events; +use App\Models\Notification; use App\Models\Task; use Illuminate\Http\Request; use Illuminate\Http\JsonResponse; @@ -95,6 +96,11 @@ class EventsController extends Controller return $task->users; })->unique('id'); + $notification = Notification::create([ + 'content' => "L'événement '{$event->name}' a été supprimé. Vous n'y participez donc plus." + ]); + $notification->users()->attach($participants->pluck('id')); + foreach ($participants as $user) { broadcast(new EventParticipationCancelled( $user->id,