create notification on delete event
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user