create notification on delete event

This commit is contained in:
2026-03-12 09:38:58 +01:00
parent d51d6a9c3f
commit 2dcc861317
@@ -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,