From a33b6354bfa85860f738399fcbf38f5a86241d4e Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Sun, 8 Mar 2026 22:11:46 +0100
Subject: [PATCH 01/51] create a test mail
---
app/Mail/TestMail.php | 57 ++++++++++++++++++++++++++++
resources/views/mails/test.blade.php | 12 ++++++
2 files changed, 69 insertions(+)
create mode 100644 app/Mail/TestMail.php
create mode 100644 resources/views/mails/test.blade.php
diff --git a/app/Mail/TestMail.php b/app/Mail/TestMail.php
new file mode 100644
index 0000000..036d55f
--- /dev/null
+++ b/app/Mail/TestMail.php
@@ -0,0 +1,57 @@
+data = $data;
+ }
+
+ /**
+ * Get the message envelope.
+ */
+ public function envelope(): Envelope
+ {
+ return new Envelope(
+ subject: 'Test Mail',
+ );
+ }
+
+ /**
+ * Get the message content definition.
+ */
+ public function content(): Content
+ {
+ return new Content(
+ view: 'mails.test',
+ with: [
+ 'name' => $this->data['name'],
+ ]
+ );
+ }
+
+ /**
+ * Get the attachments for the message.
+ *
+ * @return array
+ */
+ public function attachments(): array
+ {
+ return [];
+ }
+}
diff --git a/resources/views/mails/test.blade.php b/resources/views/mails/test.blade.php
new file mode 100644
index 0000000..62d0eb1
--- /dev/null
+++ b/resources/views/mails/test.blade.php
@@ -0,0 +1,12 @@
+
+
+
+
+
+ Test Email
+
+
+Hello {{ $name }}
+This is a test email sent from your application using MailHog!
+
+
From e720c6c5dd07830f136deffa07a131a910722e1e Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Sun, 8 Mar 2026 22:12:12 +0100
Subject: [PATCH 02/51] create and send an email on account validate
---
app/Http/Controllers/UserController.php | 10 ++++
app/Mail/ValidateMail.php | 58 ++++++++++++++++++++++++
resources/views/mails/validate.blade.php | 12 +++++
3 files changed, 80 insertions(+)
create mode 100644 app/Mail/ValidateMail.php
create mode 100644 resources/views/mails/validate.blade.php
diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php
index 1eb2f3e..751c741 100644
--- a/app/Http/Controllers/UserController.php
+++ b/app/Http/Controllers/UserController.php
@@ -3,6 +3,8 @@
namespace App\Http\Controllers;
use App\Events\UserCreated;
+use App\Mail\TestMail;
+use App\Mail\ValidateMail;
use App\Models\Notification;
use App\Models\User;
use Illuminate\Database\Eloquent\ModelNotFoundException;
@@ -12,6 +14,7 @@ use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Log;
use App\Services\UserService;
+use Illuminate\Support\Facades\Mail;
use Pest\Support\Str;
use Propaganistas\LaravelPhone\PhoneNumber;
@@ -193,6 +196,13 @@ class UserController extends Controller
$user->verified_at = now();
$user->save();
+
+ $data = [
+ 'name' => $user->name,
+ 'lastname' => $user->lastname,
+ ];
+ Mail::to($user->email)->send(new ValidateMail($data));
+
return response()->json(['message' => 'User validated successfully']);
} catch(\Exception $e) {
diff --git a/app/Mail/ValidateMail.php b/app/Mail/ValidateMail.php
new file mode 100644
index 0000000..9002787
--- /dev/null
+++ b/app/Mail/ValidateMail.php
@@ -0,0 +1,58 @@
+data = $data;
+ }
+
+ /**
+ * Get the message envelope.
+ */
+ public function envelope(): Envelope
+ {
+ return new Envelope(
+ subject: 'Compte validé - Comité des fêtes de Beaupont',
+ );
+ }
+
+ /**
+ * Get the message content definition.
+ */
+ public function content(): Content
+ {
+ return new Content(
+ view: 'mails.validate',
+ with: [
+ 'name' => $this->data['name'],
+ 'lastname' => $this->data['lastname'],
+ ]
+ );
+ }
+
+ /**
+ * Get the attachments for the message.
+ *
+ * @return array
+ */
+ public function attachments(): array
+ {
+ return [];
+ }
+}
diff --git a/resources/views/mails/validate.blade.php b/resources/views/mails/validate.blade.php
new file mode 100644
index 0000000..e9690f5
--- /dev/null
+++ b/resources/views/mails/validate.blade.php
@@ -0,0 +1,12 @@
+
+
+
+
+
+ Test Email
+
+
+Bonjour {{ $name }} {{ $lastname }},
+Votre compte sur le site de gestion des bénévoles de l'assiocation des comitées des fêtes de Beaupont à été validé.
+
+
From 9986dfa956070e3c9e3bdf092c7836ef9cbc137f Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Mon, 9 Mar 2026 16:53:38 +0100
Subject: [PATCH 03/51] add user_id attribut on Notifications table
---
app/Models/Notification.php | 1 +
.../migrations/2025_11_07_103448_create_notifications_table.php | 1 +
2 files changed, 2 insertions(+)
diff --git a/app/Models/Notification.php b/app/Models/Notification.php
index 24237b3..afbd645 100644
--- a/app/Models/Notification.php
+++ b/app/Models/Notification.php
@@ -8,6 +8,7 @@ class Notification extends Model
{
protected $fillable = [
'content',
+ 'user_id',
];
public function users(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
diff --git a/database/migrations/2025_11_07_103448_create_notifications_table.php b/database/migrations/2025_11_07_103448_create_notifications_table.php
index a574923..7c51134 100644
--- a/database/migrations/2025_11_07_103448_create_notifications_table.php
+++ b/database/migrations/2025_11_07_103448_create_notifications_table.php
@@ -15,6 +15,7 @@ return new class extends Migration
$table->id();
$table->timestamps();
$table->string('content');
+ $table->integer('user_id')->default(null);
});
}
From d51d6a9c3f7996a471c87a33b6b7894ec1f127be Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Thu, 12 Mar 2026 09:38:25 +0100
Subject: [PATCH 04/51] create notification on delete task, assign user and
unassign user
---
app/Http/Controllers/TasksController.php | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/app/Http/Controllers/TasksController.php b/app/Http/Controllers/TasksController.php
index f786bee..0b7e444 100644
--- a/app/Http/Controllers/TasksController.php
+++ b/app/Http/Controllers/TasksController.php
@@ -6,6 +6,7 @@ use App\Events\TaskParticipationCancelled;
use App\Events\VolunteerAssignedToTask;
use App\Events\VolunteerUnassignedFromTask;
use App\Models\Events;
+use App\Models\Notification;
use App\Models\Task;
use App\Models\User;
use Illuminate\Http\JsonResponse;
@@ -88,6 +89,10 @@ class TasksController extends Controller
if($user) {
$task->users()->attach($id);
+ $notification = Notification::create([
+ 'content' => "Vous avez été assigné à la tâche {$task->title} de l'événement {$task->event->name}."
+ ]);
+ $notification->users()->attach($user->id);
broadcast(new VolunteerAssignedToTask(
$user->id,
$task,
@@ -131,6 +136,12 @@ class TasksController extends Controller
}
$participants = $task->users;
+ if ($participants->isNotEmpty()) {
+ $notification = Notification::create([
+ 'content' => "La tâche '{$task->title}' pour l'événement '{$task->event->name}' a été supprimée. Vous n'y participez donc plus."
+ ]);
+ $notification->users()->attach($participants->pluck('id'));
+ }
foreach ($participants as $user) {
broadcast(new TaskParticipationCancelled(
@@ -227,7 +238,10 @@ class TasksController extends Controller
if ($user) {
$task->users()->detach($id);
-
+ $notification = Notification::create([
+ 'content' => "Vous avez été désassigné de la tâche {$task->title} de l'événement {$task->event->name}."
+ ]);
+ $notification->users()->attach($user->id);
broadcast(new VolunteerUnassignedFromTask(
$user->id,
$task,
From 2dcc861317d268fae21d47fcadea1455d54dd57b Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Thu, 12 Mar 2026 09:38:58 +0100
Subject: [PATCH 05/51] 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,
From a65dcdee3be4f5436927112948ba50075ed3874b Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Thu, 12 Mar 2026 09:39:36 +0100
Subject: [PATCH 06/51] add user_id property on notification
---
app/Http/Controllers/UserController.php | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php
index 751c741..91bddfc 100644
--- a/app/Http/Controllers/UserController.php
+++ b/app/Http/Controllers/UserController.php
@@ -3,7 +3,7 @@
namespace App\Http\Controllers;
use App\Events\UserCreated;
-use App\Mail\TestMail;
+use App\Events\UserValidated;
use App\Mail\ValidateMail;
use App\Models\Notification;
use App\Models\User;
@@ -50,6 +50,7 @@ class UserController extends Controller
$notification = Notification::create([
'content' => "Nouvelle demande d'inscription : {$user->name} {$user->lastname}",
+ 'user_id' => $user->id,
]);
$admins = User::whereIn('role', [1, 2])->get();
$notification->users()->attach(
@@ -182,11 +183,9 @@ class UserController extends Controller
try {
$user = User::find($id);
- $content = "Nouvelle demande d'inscription : {$user->name} {$user->lastname}";
- //$notification = Notification::where('user_id', $user->id)
- $notification = Notification::where('content', $content)->first();
+ $notifications = Notification::where('user_id', $user->id)->get();
- if ($notification) {
+ foreach ($notifications as $notification) {
$notification->users()->detach();
$notification->delete();
}
@@ -202,6 +201,7 @@ class UserController extends Controller
'lastname' => $user->lastname,
];
Mail::to($user->email)->send(new ValidateMail($data));
+ broadcast(new UserValidated($user));
return response()->json(['message' => 'User validated successfully']);
From 15cd88c461af654b616f39cb2d8ca4493a0b0765 Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Thu, 12 Mar 2026 09:40:14 +0100
Subject: [PATCH 07/51] rename privateChannel to users.admin
---
app/Events/UserCreated.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/Events/UserCreated.php b/app/Events/UserCreated.php
index c5274eb..ead5cf3 100644
--- a/app/Events/UserCreated.php
+++ b/app/Events/UserCreated.php
@@ -32,7 +32,7 @@ class UserCreated implements ShouldBroadcastNow
public function broadcastOn(): array
{
return [
- new privateChannel('users.registration'),
+ new privateChannel('users.admin'),
];
}
From bed8c79c0a0fd0b063fd65e4f19ded477cf32bc1 Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Thu, 12 Mar 2026 09:40:29 +0100
Subject: [PATCH 08/51] create event on user validated
---
app/Events/UserValidated.php | 44 ++++++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
create mode 100644 app/Events/UserValidated.php
diff --git a/app/Events/UserValidated.php b/app/Events/UserValidated.php
new file mode 100644
index 0000000..522c602
--- /dev/null
+++ b/app/Events/UserValidated.php
@@ -0,0 +1,44 @@
+user = $user;
+ }
+
+ /**
+ * Get the channels the event should broadcast on.
+ *
+ * @return array
+ */
+ public function broadcastOn(): array
+ {
+ return [
+ new privateChannel('users.admin'),
+ ];
+ }
+
+ public function broadcastAs()
+ {
+ return 'users.validation';
+ }
+}
+
From d2dd44af4dce4f92df24eb7198f61b37d510d6c6 Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Thu, 12 Mar 2026 10:19:58 +0100
Subject: [PATCH 09/51] update channel name into users.admin
---
routes/channels.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/routes/channels.php b/routes/channels.php
index e819e24..57bc353 100644
--- a/routes/channels.php
+++ b/routes/channels.php
@@ -3,7 +3,7 @@
use Illuminate\Support\Facades\Broadcast;
-Broadcast::channel('users.registration', function ($user) {
+Broadcast::channel('users.admin', function ($user) {
return in_array($user->role, [1, 2]);
});
From c16a9d1785ed27a6927ca6c07b3118226b77a452 Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Thu, 12 Mar 2026 11:01:44 +0100
Subject: [PATCH 10/51] remove unecessary delete notifications on validate user
---
app/Events/UserValidated.php | 44 -------------------------
app/Http/Controllers/UserController.php | 8 -----
2 files changed, 52 deletions(-)
delete mode 100644 app/Events/UserValidated.php
diff --git a/app/Events/UserValidated.php b/app/Events/UserValidated.php
deleted file mode 100644
index 522c602..0000000
--- a/app/Events/UserValidated.php
+++ /dev/null
@@ -1,44 +0,0 @@
-user = $user;
- }
-
- /**
- * Get the channels the event should broadcast on.
- *
- * @return array
- */
- public function broadcastOn(): array
- {
- return [
- new privateChannel('users.admin'),
- ];
- }
-
- public function broadcastAs()
- {
- return 'users.validation';
- }
-}
-
diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php
index 91bddfc..60d69df 100644
--- a/app/Http/Controllers/UserController.php
+++ b/app/Http/Controllers/UserController.php
@@ -183,13 +183,6 @@ class UserController extends Controller
try {
$user = User::find($id);
- $notifications = Notification::where('user_id', $user->id)->get();
-
- foreach ($notifications as $notification) {
- $notification->users()->detach();
- $notification->delete();
- }
-
$user->validate = 1;
$user->role = 3;
$user->verified_at = now();
@@ -201,7 +194,6 @@ class UserController extends Controller
'lastname' => $user->lastname,
];
Mail::to($user->email)->send(new ValidateMail($data));
- broadcast(new UserValidated($user));
return response()->json(['message' => 'User validated successfully']);
From 3d7c76496fe9b4e0b35e17f06004cf5dd1e028be Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Thu, 12 Mar 2026 11:01:54 +0100
Subject: [PATCH 11/51] remove unecessary delete notifications on validate user
---
app/Http/Controllers/UserController.php | 1 -
1 file changed, 1 deletion(-)
diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php
index 60d69df..6b19a15 100644
--- a/app/Http/Controllers/UserController.php
+++ b/app/Http/Controllers/UserController.php
@@ -3,7 +3,6 @@
namespace App\Http\Controllers;
use App\Events\UserCreated;
-use App\Events\UserValidated;
use App\Mail\ValidateMail;
use App\Models\Notification;
use App\Models\User;
From a189ce98a00691cce72b705265c46edd269cf603 Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Thu, 12 Mar 2026 15:52:07 +0100
Subject: [PATCH 12/51] call .env variables in cors.php
---
config/cors.php | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/config/cors.php b/config/cors.php
index fb1bf26..19f2551 100644
--- a/config/cors.php
+++ b/config/cors.php
@@ -15,11 +15,14 @@ return [
|
*/
- 'paths' => ['api/*', 'sanctum/csrf-cookie', 'broadcasting/auth'],
+
+ 'paths' => explode(',', env('CORS_PATHS', 'api/*')),
'allowed_methods' => ['*'],
- 'allowed_origins' => env('DEV', 0) == 1 ? ['http://localhost:5173'] : ['http://localhost'],
+ 'allowed_origins' => env('DEV', 0) == 1
+ ? explode(',', env('DEV_CORS_ALLOWED_ORIGINS'))
+ : explode(',', env('PROD_CORS_ALLOWED_ORIGINS')),
'allowed_origins_patterns' => [],
From 922b4df8b501edfc5b151eddf5cbc5468e1161fa Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Fri, 13 Mar 2026 15:30:54 +0100
Subject: [PATCH 13/51] rename model in singular
---
app/Events/EventParticipationCancelled.php | 4 ++--
app/Events/TaskParticipationCancelled.php | 4 ++--
app/Events/VolunteerAssignedToTask.php | 4 ++--
app/Events/VolunteerUnassignedFromTask.php | 4 ++--
app/Http/Controllers/EventsController.php | 18 +++++++++---------
app/Http/Controllers/TasksController.php | 6 +++---
app/Http/Controllers/UserController.php | 3 +--
app/Models/{Events.php => Event.php} | 2 +-
app/Models/Notification.php | 1 -
app/Models/Task.php | 7 ++-----
app/Observers/EventObserver.php | 8 ++++----
app/Policies/EventsPolicy.php | 2 +-
app/Providers/AppServiceProvider.php | 4 ++--
app/Providers/GateServiceProvider.php | 4 ++--
app/Services/TypesenseService.php | 4 ++--
app/Services/UserService.php | 1 +
.../{EventsFactory.php => EventFactory.php} | 4 ++--
...11_07_103448_create_notifications_table.php | 1 -
.../2025_11_09_144248_create_tasks_table.php | 2 +-
database/seeders/DevSeeder.php | 4 ++--
tests/collection.bru | 2 +-
21 files changed, 42 insertions(+), 47 deletions(-)
rename app/Models/{Events.php => Event.php} (92%)
rename database/factories/{EventsFactory.php => EventFactory.php} (89%)
diff --git a/app/Events/EventParticipationCancelled.php b/app/Events/EventParticipationCancelled.php
index 679fe7e..b975fac 100644
--- a/app/Events/EventParticipationCancelled.php
+++ b/app/Events/EventParticipationCancelled.php
@@ -2,7 +2,7 @@
namespace App\Events;
-use App\Models\Events;
+use App\Models\Event;
use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PresenceChannel;
@@ -22,7 +22,7 @@ class EventParticipationCancelled implements ShouldBroadcastNow
/**
* Create a new event instance.
*/
- public function __construct($userId, Events $event)
+ public function __construct($userId, Event $event)
{
$this->userId = $userId;
$this->event = $event;
diff --git a/app/Events/TaskParticipationCancelled.php b/app/Events/TaskParticipationCancelled.php
index 2a45dd3..51a3d91 100644
--- a/app/Events/TaskParticipationCancelled.php
+++ b/app/Events/TaskParticipationCancelled.php
@@ -2,7 +2,7 @@
namespace App\Events;
-use App\Models\Events;
+use App\Models\Event;
use App\Models\Task;
use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
@@ -24,7 +24,7 @@ class TaskParticipationCancelled implements ShouldBroadcastNow
/**
* Create a new event instance.
*/
- public function __construct($userId, Task $task, Events $event)
+ public function __construct($userId, Task $task, Event $event)
{
$this->userId = $userId;
$this->task = $task;
diff --git a/app/Events/VolunteerAssignedToTask.php b/app/Events/VolunteerAssignedToTask.php
index 959dc0c..139ead3 100644
--- a/app/Events/VolunteerAssignedToTask.php
+++ b/app/Events/VolunteerAssignedToTask.php
@@ -2,7 +2,7 @@
namespace App\Events;
-use App\Models\Events;
+use App\Models\Event;
use App\Models\Task;
use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
@@ -24,7 +24,7 @@ class VolunteerAssignedToTask implements ShouldBroadcastNow
/**
* Create a new event instance.
*/
- public function __construct($userId, Task $task, Events $event)
+ public function __construct($userId, Task $task, Event $event)
{
$this->userId = $userId;
$this->task = $task;
diff --git a/app/Events/VolunteerUnassignedFromTask.php b/app/Events/VolunteerUnassignedFromTask.php
index 5ff4e43..56cbfb7 100644
--- a/app/Events/VolunteerUnassignedFromTask.php
+++ b/app/Events/VolunteerUnassignedFromTask.php
@@ -2,7 +2,7 @@
namespace App\Events;
-use App\Models\Events;
+use App\Models\Event;
use App\Models\Task;
use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
@@ -24,7 +24,7 @@ class VolunteerUnassignedFromTask implements ShouldBroadcastNow
/**
* Create a new event instance.
*/
- public function __construct($userId, Task $task, Events $event)
+ public function __construct($userId, Task $task, Event $event)
{
$this->userId = $userId;
$this->task = $task;
diff --git a/app/Http/Controllers/EventsController.php b/app/Http/Controllers/EventsController.php
index ca419e6..80adc0f 100644
--- a/app/Http/Controllers/EventsController.php
+++ b/app/Http/Controllers/EventsController.php
@@ -3,7 +3,7 @@
namespace App\Http\Controllers;
use App\Events\EventParticipationCancelled;
-use App\Models\Events;
+use App\Models\Event;
use App\Models\Notification;
use App\Models\Task;
use Illuminate\Http\Request;
@@ -18,13 +18,13 @@ class EventsController extends Controller
{
- if (Gate::denies('create', Events::class)) {
+ if (Gate::denies('create', Event::class)) {
return response()->json(['message' => 'Forbidden'], 403);
}
try {
- Events::create([
+ Event::create([
"name" => $request['name'],
"description" => $request['description'],
"start" => $request['start'],
@@ -42,13 +42,13 @@ class EventsController extends Controller
public function update(Request $request, int $id): JsonResponse {
- if (Gate::denies('update', Events::class)) {
+ if (Gate::denies('update', Event::class)) {
return response()->json(['message' => 'Forbidden'], 403);
}
try {
- $event = Events::find($id);
+ $event = Event::find($id);
$event->name = $request['name'];
$event->description = $request['description'];
@@ -68,7 +68,7 @@ class EventsController extends Controller
try {
- $events = Events::with('tasks')->get();
+ $events = Event::with('tasks')->get();
return response()->json(['data' => $events]);
@@ -81,12 +81,12 @@ class EventsController extends Controller
public function delete(Request $request, int $id): JsonResponse {
- if (Gate::denies('delete', Events::class)) {
+ if (Gate::denies('delete', Event::class)) {
return response()->json(['message' => 'Forbidden'], 403);
}
try {
- $event = Events::with('tasks.users')->find($id);
+ $event = Event::with('tasks.users')->find($id);
if (!$event) {
return response()->json(['message' => 'Event not found'], 404);
@@ -122,7 +122,7 @@ class EventsController extends Controller
try {
- $event = Events::find($id);
+ $event = Event::find($id);
return response()->json([
"id" => $event->id,
"name" => $event->name,
diff --git a/app/Http/Controllers/TasksController.php b/app/Http/Controllers/TasksController.php
index 0b7e444..1ea1fd4 100644
--- a/app/Http/Controllers/TasksController.php
+++ b/app/Http/Controllers/TasksController.php
@@ -5,7 +5,7 @@ namespace App\Http\Controllers;
use App\Events\TaskParticipationCancelled;
use App\Events\VolunteerAssignedToTask;
use App\Events\VolunteerUnassignedFromTask;
-use App\Models\Events;
+use App\Models\Event;
use App\Models\Notification;
use App\Models\Task;
use App\Models\User;
@@ -24,7 +24,7 @@ class TasksController extends Controller
try {
- $event = Events::find($request["event_id"]);
+ $event = Event::find($request["event_id"]);
$event->tasks()->create([
"name" => $request["name"],
@@ -112,7 +112,7 @@ class TasksController extends Controller
try {
- $event = Events::find($id);
+ $event = Event::find($id);
return response()->json(['data' => $event->tasks()->get()]);
diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php
index 6b19a15..8bb5cd5 100644
--- a/app/Http/Controllers/UserController.php
+++ b/app/Http/Controllers/UserController.php
@@ -48,8 +48,7 @@ class UserController extends Controller
$notification = Notification::create([
- 'content' => "Nouvelle demande d'inscription : {$user->name} {$user->lastname}",
- 'user_id' => $user->id,
+ 'content' => "Nouvelle demande d'inscription : {$user->name} {$user->lastname}"
]);
$admins = User::whereIn('role', [1, 2])->get();
$notification->users()->attach(
diff --git a/app/Models/Events.php b/app/Models/Event.php
similarity index 92%
rename from app/Models/Events.php
rename to app/Models/Event.php
index 94ce833..8709fb0 100644
--- a/app/Models/Events.php
+++ b/app/Models/Event.php
@@ -5,7 +5,7 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
-class Events extends Model
+class Event extends Model
{
use HasFactory;
protected $fillable = [
diff --git a/app/Models/Notification.php b/app/Models/Notification.php
index afbd645..e3bfe5b 100644
--- a/app/Models/Notification.php
+++ b/app/Models/Notification.php
@@ -17,7 +17,6 @@ class Notification extends Model
User::class,
'notification_user',
'notification_id',
- 'user_id'
)
->withPivot('unread')
->withTimestamps();
diff --git a/app/Models/Task.php b/app/Models/Task.php
index c569495..e0dd0b7 100644
--- a/app/Models/Task.php
+++ b/app/Models/Task.php
@@ -2,13 +2,10 @@
namespace App\Models;
-use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
-class Task extends Model
+class Task extends Model
{
- use HasFactory;
-
protected $fillable = [
'name',
'start',
@@ -19,7 +16,7 @@ class Task extends Model
];
public function event() {
- return $this->belongsTo(Events::class);
+ return $this->belongsTo(Event::class);
}
public function users() {
diff --git a/app/Observers/EventObserver.php b/app/Observers/EventObserver.php
index 6991bb4..2c13028 100644
--- a/app/Observers/EventObserver.php
+++ b/app/Observers/EventObserver.php
@@ -2,22 +2,22 @@
namespace App\Observers;
-use App\Models\Events;
+use App\Models\Event;
use App\Services\TypesenseService;
class EventObserver
{
- public function created(Events $event)
+ public function created(Event $event)
{
app(TypesenseService::class)->upsertEvent($event);
}
- public function updated(Events $event)
+ public function updated(Event $event)
{
app(TypesenseService::class)->upsertEvent($event);
}
- public function deleted(Events $event)
+ public function deleted(Event $event)
{
app(TypesenseService::class)->deleteEvent($event->id);
}
diff --git a/app/Policies/EventsPolicy.php b/app/Policies/EventsPolicy.php
index a888718..abbed2f 100644
--- a/app/Policies/EventsPolicy.php
+++ b/app/Policies/EventsPolicy.php
@@ -2,7 +2,7 @@
namespace App\Policies;
-use App\Models\Events;
+use App\Models\Event;
use App\Models\User;
use Illuminate\Auth\Access\Response;
diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php
index 1cbe384..ba8c9ac 100644
--- a/app/Providers/AppServiceProvider.php
+++ b/app/Providers/AppServiceProvider.php
@@ -2,7 +2,7 @@
namespace App\Providers;
-use App\Models\Events;
+use App\Models\Event;
use App\Models\User;
use App\Observers\EventObserver;
use App\Observers\UserObserver;
@@ -30,6 +30,6 @@ class AppServiceProvider extends ServiceProvider
Route::middleware('web')->prefix('api')->group(base_path('routes/notifications.php'));
Route::middleware('web')->prefix('api')->group(base_path('routes/channels.php'));
User::observe(UserObserver::class);
- Events::observe(EventObserver::class);
+ Event::observe(EventObserver::class);
}
}
diff --git a/app/Providers/GateServiceProvider.php b/app/Providers/GateServiceProvider.php
index 6e7d69c..094ec54 100644
--- a/app/Providers/GateServiceProvider.php
+++ b/app/Providers/GateServiceProvider.php
@@ -2,7 +2,7 @@
namespace App\Providers;
-use App\Models\Events;
+use App\Models\Event;
use App\Models\Task;
use App\Models\User;
use App\Policies\EventsPolicy;
@@ -27,7 +27,7 @@ class GateServiceProvider extends ServiceProvider
public function boot(): void
{
Gate::policy(User::class, UsersPolicy::class);
- Gate::policy(Events::class, EventsPolicy::class);
+ Gate::policy(Event::class, EventsPolicy::class);
Gate::policy(Task::class, TasksPolicy::class);
}
}
diff --git a/app/Services/TypesenseService.php b/app/Services/TypesenseService.php
index adfe500..c00153c 100644
--- a/app/Services/TypesenseService.php
+++ b/app/Services/TypesenseService.php
@@ -3,7 +3,7 @@
namespace App\Services;
use App\Models\User;
-use App\Models\Events;
+use App\Models\Event;
use Illuminate\Support\Facades\Cache;
use Typesense\Client;
@@ -65,7 +65,7 @@ class TypesenseService
}
}
- public function upsertEvent(Events $event): void
+ public function upsertEvent(Event $event): void
{
$this->ensureCollectionsExist();
diff --git a/app/Services/UserService.php b/app/Services/UserService.php
index f95070c..01df1da 100644
--- a/app/Services/UserService.php
+++ b/app/Services/UserService.php
@@ -2,6 +2,7 @@
namespace App\Services;
use App\Models\User;
+use Illuminate\Support\Facades\Log;
class UserService
{
diff --git a/database/factories/EventsFactory.php b/database/factories/EventFactory.php
similarity index 89%
rename from database/factories/EventsFactory.php
rename to database/factories/EventFactory.php
index 17d97d4..22651e6 100644
--- a/database/factories/EventsFactory.php
+++ b/database/factories/EventFactory.php
@@ -5,9 +5,9 @@ namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
- * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Events>
+ * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Event>
*/
-class EventsFactory extends Factory
+class EventFactory extends Factory
{
/**
* Define the model's default state.
diff --git a/database/migrations/2025_11_07_103448_create_notifications_table.php b/database/migrations/2025_11_07_103448_create_notifications_table.php
index 7c51134..a574923 100644
--- a/database/migrations/2025_11_07_103448_create_notifications_table.php
+++ b/database/migrations/2025_11_07_103448_create_notifications_table.php
@@ -15,7 +15,6 @@ return new class extends Migration
$table->id();
$table->timestamps();
$table->string('content');
- $table->integer('user_id')->default(null);
});
}
diff --git a/database/migrations/2025_11_09_144248_create_tasks_table.php b/database/migrations/2025_11_09_144248_create_tasks_table.php
index e6ce615..b8c6363 100644
--- a/database/migrations/2025_11_09_144248_create_tasks_table.php
+++ b/database/migrations/2025_11_09_144248_create_tasks_table.php
@@ -21,7 +21,7 @@ return new class extends Migration
$table->dateTime("end");
$table->integer('max_participants');
- $table->foreignId("events_id")->constrained("events")->onDelete("cascade");
+ $table->foreignId("event_id")->constrained("events")->onDelete("cascade");
$table->timestamps();
});
diff --git a/database/seeders/DevSeeder.php b/database/seeders/DevSeeder.php
index c743000..06b033f 100644
--- a/database/seeders/DevSeeder.php
+++ b/database/seeders/DevSeeder.php
@@ -2,7 +2,7 @@
namespace Database\Seeders;
-use App\Models\Events;
+use App\Models\Event;
use App\Models\User;
use App\Services\TypesenseService;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
@@ -33,7 +33,7 @@ class DevSeeder extends Seeder
User::factory()->count(10)->create();
- Events::factory()->count(10)->create();
+ Event::factory()->count(10)->create();
}
}
diff --git a/tests/collection.bru b/tests/collection.bru
index f18ae36..b0aa5f7 100644
--- a/tests/collection.bru
+++ b/tests/collection.bru
@@ -1,4 +1,4 @@
headers {
Accept: application/json
- X-XSRF-TOKEN:
+ X-XSRF-TOKEN: eyJpdiI6ImVGRmdjSGtkUUtUT2E3TVE0RVM3c0E9PSIsInZhbHVlIjoiTkNldWpJb0I3T1dQMVJmTm43ekRPa2ZocFRZc25jYVlyZ0RBVDV3UjJVVDdpQkI1MUtkNWZROS9xbHdPUElHNTlrcjh2TUIxaTNtL20wYXZpdnltRGhNTGpsSGZETFV3VUtNd200OWcwUXFiYU9Eamd1VmFxRzVBNVNZVHBxMEEiLCJtYWMiOiJiMTM1OGVhOGRjM2VjMTg5ZDk4MzMwMjBmNjBkZjQ4OGIzODcwZjMzYzZkOTQxY2E5YjYyMDUxNGY5MzFjNjA1IiwidGFnIjoiIn0=
}
From 6ff9d3a6a76b4c8a32fc5ca43031e15842b6fffe Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Wed, 18 Mar 2026 09:32:36 +0100
Subject: [PATCH 14/51] remove test email
---
app/Mail/TestMail.php | 57 ----------------------------
resources/views/mails/test.blade.php | 12 ------
2 files changed, 69 deletions(-)
delete mode 100644 app/Mail/TestMail.php
delete mode 100644 resources/views/mails/test.blade.php
diff --git a/app/Mail/TestMail.php b/app/Mail/TestMail.php
deleted file mode 100644
index 036d55f..0000000
--- a/app/Mail/TestMail.php
+++ /dev/null
@@ -1,57 +0,0 @@
-data = $data;
- }
-
- /**
- * Get the message envelope.
- */
- public function envelope(): Envelope
- {
- return new Envelope(
- subject: 'Test Mail',
- );
- }
-
- /**
- * Get the message content definition.
- */
- public function content(): Content
- {
- return new Content(
- view: 'mails.test',
- with: [
- 'name' => $this->data['name'],
- ]
- );
- }
-
- /**
- * Get the attachments for the message.
- *
- * @return array
- */
- public function attachments(): array
- {
- return [];
- }
-}
diff --git a/resources/views/mails/test.blade.php b/resources/views/mails/test.blade.php
deleted file mode 100644
index 62d0eb1..0000000
--- a/resources/views/mails/test.blade.php
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
- Test Email
-
-
-Hello {{ $name }}
-This is a test email sent from your application using MailHog!
-
-
From 7ff2f6a6d0722b2a3f8647a11b49b3ba47170c17 Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Wed, 18 Mar 2026 09:40:43 +0100
Subject: [PATCH 15/51] improve validate mail
---
resources/views/mails/validate.blade.php | 55 +++++++++++++++++++-----
1 file changed, 45 insertions(+), 10 deletions(-)
diff --git a/resources/views/mails/validate.blade.php b/resources/views/mails/validate.blade.php
index e9690f5..9c07457 100644
--- a/resources/views/mails/validate.blade.php
+++ b/resources/views/mails/validate.blade.php
@@ -1,12 +1,47 @@
-
-
-
-
- Test Email
-
-
-Bonjour {{ $name }} {{ $lastname }},
-Votre compte sur le site de gestion des bénévoles de l'assiocation des comitées des fêtes de Beaupont à été validé.
-
+
+
+
+
+ Compte validé
+
+
+
+
+
+
🎉 Compte validé !
+
+
+
+
Bonjour {{ $name }} {{ $lastname }},
+
+
+ Nous avons le plaisir de vous informer que votre compte sur le site de gestion des bénévoles du Comité des fêtes de Beaupont a été validé avec succès.
+
+
+
+ Vous pouvez dès à présent accéder à votre espace personnel et participer aux différentes activités proposées.
+
+
+
+
+
+ Si vous avez la moindre question ou besoin d’assistance, n’hésitez pas à nous contacter.
+
+
+
+ À très bientôt,
+ L’équipe du Comité des fêtes de Beaupont
+
+
+
+
+ Cet email a été envoyé automatiquement, merci de ne pas y répondre.
+
+
From 870151cdd3c8ca85379fb17476a82e2f20cdbb08 Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Wed, 18 Mar 2026 09:41:54 +0100
Subject: [PATCH 16/51] create a mail when an account is created by an
administrator
---
app/Http/Controllers/UserController.php | 8 +++
app/Mail/CreateUserByAdminMail.php | 58 +++++++++++++++++++
.../views/mails/createUserByAdmin.blade.php | 48 +++++++++++++++
3 files changed, 114 insertions(+)
create mode 100644 app/Mail/CreateUserByAdminMail.php
create mode 100644 resources/views/mails/createUserByAdmin.blade.php
diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php
index 751c741..3654c4c 100644
--- a/app/Http/Controllers/UserController.php
+++ b/app/Http/Controllers/UserController.php
@@ -3,6 +3,7 @@
namespace App\Http\Controllers;
use App\Events\UserCreated;
+use App\Mail\CreateUserByAdminMail;
use App\Mail\TestMail;
use App\Mail\ValidateMail;
use App\Models\Notification;
@@ -86,6 +87,13 @@ class UserController extends Controller
"phone" => $phone->formatInternational(),
]);
+ $data = [
+ 'name' => $user->name,
+ 'lastname' => $user->lastname,
+ ];
+ Mail::to($user->email)->send(new CreateUserByAdminMail($data));
+
+
return response()->json([
'message' => 'User created successfully',
"password" => $password,
diff --git a/app/Mail/CreateUserByAdminMail.php b/app/Mail/CreateUserByAdminMail.php
new file mode 100644
index 0000000..1a9d6ff
--- /dev/null
+++ b/app/Mail/CreateUserByAdminMail.php
@@ -0,0 +1,58 @@
+data = $data;
+ }
+
+ /**
+ * Get the message envelope.
+ */
+ public function envelope(): Envelope
+ {
+ return new Envelope(
+ subject: 'Compte créé - Comité des fêtes de Beaupont',
+ );
+ }
+
+ /**
+ * Get the message content definition.
+ */
+ public function content(): Content
+ {
+ return new Content(
+ view: 'mails.createUserByAdmin',
+ with: [
+ 'name' => $this->data['name'],
+ 'lastname' => $this->data['lastname'],
+ ]
+ );
+ }
+
+ /**
+ * Get the attachments for the message.
+ *
+ * @return array
+ */
+ public function attachments(): array
+ {
+ return [];
+ }
+}
diff --git a/resources/views/mails/createUserByAdmin.blade.php b/resources/views/mails/createUserByAdmin.blade.php
new file mode 100644
index 0000000..82b23f8
--- /dev/null
+++ b/resources/views/mails/createUserByAdmin.blade.php
@@ -0,0 +1,48 @@
+
+
+
+
+
+ Compte créé
+
+
+
+
Bonjour {{ $name }} {{ $lastname }},
+
+
+ Un compte a été créé pour vous par un administrateur sur le site de gestion des bénévoles
+ du Comité des fêtes de Beaupont.
+
+
+
+ Vous pouvez dès à présent vous connecter et accéder à votre espace personnel afin de participer
+ aux activités proposées.
+
+
+
+ Veuillez vous renseigner auprès d'un administrateur pour récupérer vos identifiants.
+
+
+
+
+ Se connecter
+
+
+
+
+ Si vous n’êtes pas à l’origine de cette création de compte ou si vous avez des questions,
+ merci de contacter rapidement l’équipe organisatrice.
+
+
+
+ À très bientôt,
+ L’équipe du Comité des fêtes de Beaupont
+
+
+
+
+ Cet email a été envoyé automatiquement, merci de ne pas y répondre.
+
+
+
From d9ce927d88c634779f9ca5071b961c144116ab1b Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Wed, 18 Mar 2026 09:45:55 +0100
Subject: [PATCH 17/51] create a mail when an account is deleted by an
administrator or by the user
---
app/Http/Controllers/UserController.php | 14 +++++
app/Mail/DeleteAccountMail.php | 58 +++++++++++++++++++
resources/views/mails/deleteAccount.blade.php | 39 +++++++++++++
3 files changed, 111 insertions(+)
create mode 100644 app/Mail/DeleteAccountMail.php
create mode 100644 resources/views/mails/deleteAccount.blade.php
diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php
index 3654c4c..7a6bb32 100644
--- a/app/Http/Controllers/UserController.php
+++ b/app/Http/Controllers/UserController.php
@@ -4,6 +4,7 @@ namespace App\Http\Controllers;
use App\Events\UserCreated;
use App\Mail\CreateUserByAdminMail;
+use App\Mail\DeleteAccountMail;
use App\Mail\TestMail;
use App\Mail\ValidateMail;
use App\Models\Notification;
@@ -103,6 +104,13 @@ class UserController extends Controller
public function delete(Request $request): JsonResponse {
try {
$user = User::find($request->user()->id);
+
+ $data = [
+ 'name' => $user->name,
+ 'lastname' => $user->lastname,
+ ];
+ Mail::to($user->email)->send(new DeleteAccountMail($data));
+
$user->delete();
return response()->json(['message' => 'User deleted successfully']);
} catch(\Exception $e) {
@@ -133,6 +141,12 @@ class UserController extends Controller
try {
$user = User::find($id);
+ $data = [
+ 'name' => $user->name,
+ 'lastname' => $user->lastname,
+ ];
+ Mail::to($user->email)->send(new DeleteAccountMail($data));
+
$user->delete();
return response()->json(['message' => 'User deleted successfully']);
} catch(\Exception $e) {
diff --git a/app/Mail/DeleteAccountMail.php b/app/Mail/DeleteAccountMail.php
new file mode 100644
index 0000000..2b5571d
--- /dev/null
+++ b/app/Mail/DeleteAccountMail.php
@@ -0,0 +1,58 @@
+data = $data;
+ }
+
+ /**
+ * Get the message envelope.
+ */
+ public function envelope(): Envelope
+ {
+ return new Envelope(
+ subject: 'Compte supprimé - Comité des fêtes de Beaupont',
+ );
+ }
+
+ /**
+ * Get the message content definition.
+ */
+ public function content(): Content
+ {
+ return new Content(
+ view: 'mails.deleteAccount',
+ with: [
+ 'name' => $this->data['name'],
+ 'lastname' => $this->data['lastname'],
+ ]
+ );
+ }
+
+ /**
+ * Get the attachments for the message.
+ *
+ * @return array
+ */
+ public function attachments(): array
+ {
+ return [];
+ }
+}
diff --git a/resources/views/mails/deleteAccount.blade.php b/resources/views/mails/deleteAccount.blade.php
new file mode 100644
index 0000000..7137326
--- /dev/null
+++ b/resources/views/mails/deleteAccount.blade.php
@@ -0,0 +1,39 @@
+
+
+
+
+
+ Compte supprimé
+
+
+
+
Bonjour {{ $name }} {{ $lastname }},
+
+
+ Nous vous informons que votre compte sur le site de gestion des bénévoles
+ du Comité des fêtes de Beaupont a été supprimé.
+
+
+
+ Vous n’avez désormais plus accès à votre espace personnel ni aux services associés.
+
+
+
+ ⚠️ Si vous n’êtes pas à l’origine de cette action, merci de nous contacter rapidement.
+
+
+
+ Si vous souhaitez à nouveau participer aux activités, vous pouvez effectuer une nouvelle inscription à tout moment.
+
+
+
+ À bientôt,
+ L’équipe du Comité des fêtes de Beaupont
+
+
+
+
+ Cet email a été envoyé automatiquement, merci de ne pas y répondre.
+
+
+
From c3fb0ec094fd38471b92907c1b8eb494f1d8f6ac Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Wed, 18 Mar 2026 09:48:20 +0100
Subject: [PATCH 18/51] create a mail when an account is deactivated by an
administrator
---
app/Http/Controllers/UserController.php | 7 +++
app/Mail/DeactivateAccountMail.php | 58 +++++++++++++++++++
.../views/mails/deactivateAccount.blade.php | 40 +++++++++++++
3 files changed, 105 insertions(+)
create mode 100644 app/Mail/DeactivateAccountMail.php
create mode 100644 resources/views/mails/deactivateAccount.blade.php
diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php
index 7a6bb32..df31d4f 100644
--- a/app/Http/Controllers/UserController.php
+++ b/app/Http/Controllers/UserController.php
@@ -4,6 +4,7 @@ namespace App\Http\Controllers;
use App\Events\UserCreated;
use App\Mail\CreateUserByAdminMail;
+use App\Mail\DeactivateAccountMail;
use App\Mail\DeleteAccountMail;
use App\Mail\TestMail;
use App\Mail\ValidateMail;
@@ -165,6 +166,12 @@ class UserController extends Controller
try {
$userToDeactivate->update(['validate' => 0]);
+ $data = [
+ 'name' => $userToDeactivate->name,
+ 'lastname' => $userToDeactivate->lastname,
+ ];
+ Mail::to($userToDeactivate->email)->send(new DeactivateAccountMail($data));
+
return response()->json(['message' => 'User deactivated successfully']);
} catch (ModelNotFoundException $e) {
return response()->json(['message' => 'Utilisateur non trouvé'], 404);
diff --git a/app/Mail/DeactivateAccountMail.php b/app/Mail/DeactivateAccountMail.php
new file mode 100644
index 0000000..1ce8ff9
--- /dev/null
+++ b/app/Mail/DeactivateAccountMail.php
@@ -0,0 +1,58 @@
+data = $data;
+ }
+
+ /**
+ * Get the message envelope.
+ */
+ public function envelope(): Envelope
+ {
+ return new Envelope(
+ subject: 'Compte désactivé - Comité des fêtes de Beaupont',
+ );
+ }
+
+ /**
+ * Get the message content definition.
+ */
+ public function content(): Content
+ {
+ return new Content(
+ view: 'mails.deactivateAccount',
+ with: [
+ 'name' => $this->data['name'],
+ 'lastname' => $this->data['lastname'],
+ ]
+ );
+ }
+
+ /**
+ * Get the attachments for the message.
+ *
+ * @return array
+ */
+ public function attachments(): array
+ {
+ return [];
+ }
+}
diff --git a/resources/views/mails/deactivateAccount.blade.php b/resources/views/mails/deactivateAccount.blade.php
new file mode 100644
index 0000000..03fd4e3
--- /dev/null
+++ b/resources/views/mails/deactivateAccount.blade.php
@@ -0,0 +1,40 @@
+
+
+
+
+
+ Compte désactivé
+
+
+
+
Bonjour {{ $name }} {{ $lastname }},
+
+
+ Nous vous informons que votre compte sur le site de gestion des bénévoles
+ du Comité des fêtes de Beaupont a été désactivé par un administrateur.
+
+
+
+ Vous ne pouvez désormais plus accéder à votre espace personnel ni participer aux activités proposées.
+
+
+
+ ⚠️ Si vous pensez qu’il s’agit d’une erreur ou si vous souhaitez obtenir plus d’informations,
+ nous vous invitons à contacter l’équipe organisatrice.
+
+
+
+ Votre compte pourra être réactivé ultérieurement si nécessaire.
+
+
+
+ À bientôt,
+ L’équipe du Comité des fêtes de Beaupont
+
+
+
+
+ Cet email a été envoyé automatiquement, merci de ne pas y répondre.
+
+
+
From 96973f788436b5dd5f9bbc4ef828897be475e812 Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Wed, 18 Mar 2026 09:53:42 +0100
Subject: [PATCH 19/51] create a mail when the role of the user is updated
---
app/Http/Controllers/UserController.php | 10 ++++
app/Mail/UpdateRoleMail.php | 59 ++++++++++++++++++++++
app/Services/GetRole.php | 1 +
resources/views/mails/updateRole.blade.php | 35 +++++++++++++
4 files changed, 105 insertions(+)
create mode 100644 app/Mail/UpdateRoleMail.php
create mode 100644 resources/views/mails/updateRole.blade.php
diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php
index df31d4f..00117dd 100644
--- a/app/Http/Controllers/UserController.php
+++ b/app/Http/Controllers/UserController.php
@@ -7,6 +7,7 @@ use App\Mail\CreateUserByAdminMail;
use App\Mail\DeactivateAccountMail;
use App\Mail\DeleteAccountMail;
use App\Mail\TestMail;
+use App\Mail\UpdateRoleMail;
use App\Mail\ValidateMail;
use App\Models\Notification;
use App\Models\User;
@@ -252,6 +253,15 @@ class UserController extends Controller
$user->save();
$role = \App\Services\GetRole::getRole($request['role']);
+
+ $data = [
+ 'name' => $user->name,
+ 'lastname' => $user->lastname,
+ 'role' => $role,
+ ];
+ Mail::to($user->email)->send(new UpdateRoleMail($data));
+
+
$notification = Notification::create([
'content' => "Votre rôle à changé pour {$role} !",
]);
diff --git a/app/Mail/UpdateRoleMail.php b/app/Mail/UpdateRoleMail.php
new file mode 100644
index 0000000..64eb863
--- /dev/null
+++ b/app/Mail/UpdateRoleMail.php
@@ -0,0 +1,59 @@
+data = $data;
+ }
+
+ /**
+ * Get the message envelope.
+ */
+ public function envelope(): Envelope
+ {
+ return new Envelope(
+ subject: 'Rôle mis à jour - Comité des fêtes de Beaupont',
+ );
+ }
+
+ /**
+ * Get the message content definition.
+ */
+ public function content(): Content
+ {
+ return new Content(
+ view: 'mails.updateRole',
+ with: [
+ 'name' => $this->data['name'],
+ 'lastname' => $this->data['lastname'],
+ 'role' => $this->data['role'],
+ ]
+ );
+ }
+
+ /**
+ * Get the attachments for the message.
+ *
+ * @return array
+ */
+ public function attachments(): array
+ {
+ return [];
+ }
+}
diff --git a/app/Services/GetRole.php b/app/Services/GetRole.php
index d1ae26e..d752d7d 100644
--- a/app/Services/GetRole.php
+++ b/app/Services/GetRole.php
@@ -6,6 +6,7 @@ class GetRole
{
public static function getRole($role)
{
+ $role = (int)$role;
return match ($role) {
1 => "Président",
2 => "Gérant",
diff --git a/resources/views/mails/updateRole.blade.php b/resources/views/mails/updateRole.blade.php
new file mode 100644
index 0000000..4b5d00a
--- /dev/null
+++ b/resources/views/mails/updateRole.blade.php
@@ -0,0 +1,35 @@
+
+
+
+
+
+ Rôle mis à jour
+
+
+
+
Bonjour {{ $name }} {{ $lastname }},
+
+
+ Votre rôle sur le site de gestion des bénévoles du Comité des fêtes de Beaupont
+ a été mis à jour par un administrateur.
+
+
+
+ Vous êtes désormais : {{ $role }}
+
+
+
+ Si vous avez des questions concernant ce changement, n’hésitez pas à contacter l’équipe organisatrice.
+
+
+
+ À très bientôt,
+ L’équipe du Comité des fêtes de Beaupont
+
+
+
+
+ Cet email a été envoyé automatiquement, merci de ne pas y répondre.
+
+
+
From e713cc2857778254a6b5d27c90a58362795e4e14 Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Wed, 18 Mar 2026 09:53:54 +0100
Subject: [PATCH 20/51] create a mail when the role of the user is updated
---
app/Http/Controllers/UserController.php | 1 -
1 file changed, 1 deletion(-)
diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php
index 00117dd..fc137b3 100644
--- a/app/Http/Controllers/UserController.php
+++ b/app/Http/Controllers/UserController.php
@@ -6,7 +6,6 @@ use App\Events\UserCreated;
use App\Mail\CreateUserByAdminMail;
use App\Mail\DeactivateAccountMail;
use App\Mail\DeleteAccountMail;
-use App\Mail\TestMail;
use App\Mail\UpdateRoleMail;
use App\Mail\ValidateMail;
use App\Models\Notification;
From 66266d1b4b0d3f7d9a8ff73eb98b4b41e712d30a Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Wed, 18 Mar 2026 09:55:10 +0100
Subject: [PATCH 21/51] remove notification deletion code when validating an
account
---
app/Http/Controllers/UserController.php | 7 -------
1 file changed, 7 deletions(-)
diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php
index fc137b3..7b6f2da 100644
--- a/app/Http/Controllers/UserController.php
+++ b/app/Http/Controllers/UserController.php
@@ -212,13 +212,6 @@ class UserController extends Controller
try {
$user = User::find($id);
$content = "Nouvelle demande d'inscription : {$user->name} {$user->lastname}";
- //$notification = Notification::where('user_id', $user->id)
- $notification = Notification::where('content', $content)->first();
-
- if ($notification) {
- $notification->users()->detach();
- $notification->delete();
- }
$user->validate = 1;
$user->role = 3;
From 2271304044db4726e6ddfc809721253364b8b067 Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Wed, 18 Mar 2026 10:00:47 +0100
Subject: [PATCH 22/51] create a mail when a user registered
---
app/Http/Controllers/UserController.php | 12 ++++-
app/Mail/RegisterMail.php | 60 ++++++++++++++++++++++++
resources/views/mails/register.blade.php | 38 +++++++++++++++
3 files changed, 109 insertions(+), 1 deletion(-)
create mode 100644 app/Mail/RegisterMail.php
create mode 100644 resources/views/mails/register.blade.php
diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php
index 7b6f2da..8d0e25a 100644
--- a/app/Http/Controllers/UserController.php
+++ b/app/Http/Controllers/UserController.php
@@ -6,6 +6,7 @@ use App\Events\UserCreated;
use App\Mail\CreateUserByAdminMail;
use App\Mail\DeactivateAccountMail;
use App\Mail\DeleteAccountMail;
+use App\Mail\RegisterMail;
use App\Mail\UpdateRoleMail;
use App\Mail\ValidateMail;
use App\Models\Notification;
@@ -58,9 +59,18 @@ class UserController extends Controller
$notification->users()->attach(
$admins->pluck('id')->toArray()
);
-
broadcast(new UserCreated($user));
+ foreach ($admins as $admin) {
+ $data = [
+ 'adminName' => $admin->name,
+ 'adminLastname' => $admin->lastname,
+ 'userName' => $user->name,
+ 'userLastname' => $user->lastname,
+ ];
+ Mail::to($admin->email)->send(new RegisterMail($data));
+ }
+
return response()->json(['message' => 'User created successfully']);
}
diff --git a/app/Mail/RegisterMail.php b/app/Mail/RegisterMail.php
new file mode 100644
index 0000000..d572676
--- /dev/null
+++ b/app/Mail/RegisterMail.php
@@ -0,0 +1,60 @@
+data = $data;
+ }
+
+ /**
+ * Get the message envelope.
+ */
+ public function envelope(): Envelope
+ {
+ return new Envelope(
+ subject: 'Nouvelle demande de validation - Comité des fêtes de Beaupont',
+ );
+ }
+
+ /**
+ * Get the message content definition.
+ */
+ public function content(): Content
+ {
+ return new Content(
+ view: 'mails.register',
+ with: [
+ 'adminName' => $this->data['adminName'],
+ 'adminLastname' => $this->data['adminLastname'],
+ 'userName' => $this->data['userName'],
+ 'userLastname' => $this->data['userLastname'],
+ ]
+ );
+ }
+
+ /**
+ * Get the attachments for the message.
+ *
+ * @return array
+ */
+ public function attachments(): array
+ {
+ return [];
+ }
+}
diff --git a/resources/views/mails/register.blade.php b/resources/views/mails/register.blade.php
new file mode 100644
index 0000000..c92d7d3
--- /dev/null
+++ b/resources/views/mails/register.blade.php
@@ -0,0 +1,38 @@
+
+
+
+
+
+ Nouvelle demande de validation
+
+
+
+
Bonjour {{ $adminName }} {{ $adminLastname }},
+
+
+ L’utilisateur {{ $userName }} {{ $userLastname }} a créé un compte
+ qui est maintenant en attente de validation sur le site du Comité des fêtes de Beaupont.
+
+
+
+
+ Valider ce compte
+
+
+
+
+ Vous pouvez cliquer sur le bouton ci-dessus pour vous rendre sur la page permettant de valider le compte.
+
+
+
+ À très bientôt,
+ L’équipe du Comité des fêtes de Beaupont
+
+
+
+
+ Cet email a été envoyé automatiquement, merci de ne pas y répondre.
+
+
+
From f3d6f6bd113f727cc29990fee750fa83819d72e5 Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Wed, 18 Mar 2026 10:06:12 +0100
Subject: [PATCH 23/51] create a mail when an event is deleted to the
participants
---
app/Http/Controllers/EventsController.php | 11 ++++
app/Mail/EventParticipationCancelledMail.php | 59 +++++++++++++++++++
.../eventParticipationCancelled.blade.php | 32 ++++++++++
3 files changed, 102 insertions(+)
create mode 100644 app/Mail/EventParticipationCancelledMail.php
create mode 100644 resources/views/mails/eventParticipationCancelled.blade.php
diff --git a/app/Http/Controllers/EventsController.php b/app/Http/Controllers/EventsController.php
index b26b49e..2aed09d 100644
--- a/app/Http/Controllers/EventsController.php
+++ b/app/Http/Controllers/EventsController.php
@@ -3,12 +3,15 @@
namespace App\Http\Controllers;
use App\Events\EventParticipationCancelled;
+use App\Mail\EventParticipationCancelledMail;
+use App\Mail\ValidateMail;
use App\Models\Events;
use App\Models\Task;
use Illuminate\Http\Request;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Facades\Log;
+use Illuminate\Support\Facades\Mail;
class EventsController extends Controller
@@ -100,6 +103,14 @@ class EventsController extends Controller
$user->id,
$event
));
+
+ $data = [
+ 'name' => $user->name,
+ 'lastname' => $user->lastname,
+ 'eventName' => $event->name,
+ ];
+ Mail::to($user->email)->send(new EventParticipationCancelledMail($data));
+
}
$event->delete();
diff --git a/app/Mail/EventParticipationCancelledMail.php b/app/Mail/EventParticipationCancelledMail.php
new file mode 100644
index 0000000..2b73159
--- /dev/null
+++ b/app/Mail/EventParticipationCancelledMail.php
@@ -0,0 +1,59 @@
+data = $data;
+ }
+
+ /**
+ * Get the message envelope.
+ */
+ public function envelope(): Envelope
+ {
+ return new Envelope(
+ subject: 'Evénement supprimé - Comité des fêtes de Beaupont',
+ );
+ }
+
+ /**
+ * Get the message content definition.
+ */
+ public function content(): Content
+ {
+ return new Content(
+ view: 'mails.eventParticipationCancelled',
+ with: [
+ 'name' => $this->data['name'],
+ 'lastname' => $this->data['lastname'],
+ 'eventName' => $this->data['eventName'],
+ ]
+ );
+ }
+
+ /**
+ * Get the attachments for the message.
+ *
+ * @return array
+ */
+ public function attachments(): array
+ {
+ return [];
+ }
+}
diff --git a/resources/views/mails/eventParticipationCancelled.blade.php b/resources/views/mails/eventParticipationCancelled.blade.php
new file mode 100644
index 0000000..2c2c8c6
--- /dev/null
+++ b/resources/views/mails/eventParticipationCancelled.blade.php
@@ -0,0 +1,32 @@
+
+
+
+
+
+ Événement supprimé
+
+
+
+
Bonjour {{ $name }} {{ $lastname }},
+
+
+ L’événement {{ $eventName }} a été supprimé par un administrateur.
+ Vous n’y participez donc plus.
+
+
+
+ Si vous pensez qu’il s’agit d’une erreur ou si vous souhaitez plus d’informations,
+ merci de contacter l’équipe du Comité des fêtes de Beaupont.
+
+
+
+ À très bientôt,
+ L’équipe du Comité des fêtes de Beaupont
+
+
+
+
+ Cet email a été envoyé automatiquement, merci de ne pas y répondre.
+
+
+
From 431b9eb0bbdd30aae80b0a191b328a8918c3d726 Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Wed, 18 Mar 2026 10:11:56 +0100
Subject: [PATCH 24/51] improve delete account mail
---
resources/views/mails/deleteAccount.blade.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/resources/views/mails/deleteAccount.blade.php b/resources/views/mails/deleteAccount.blade.php
index 7137326..f9c616e 100644
--- a/resources/views/mails/deleteAccount.blade.php
+++ b/resources/views/mails/deleteAccount.blade.php
@@ -18,8 +18,8 @@
Vous n’avez désormais plus accès à votre espace personnel ni aux services associés.
-
- ⚠️ Si vous n’êtes pas à l’origine de cette action, merci de nous contacter rapidement.
+
+ Si vous n’êtes pas à l’origine de cette action, merci de nous contacter rapidement.
From 5d98678d86a26121db2f688b74afa9166950426d Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Wed, 18 Mar 2026 10:13:17 +0100
Subject: [PATCH 25/51] improve register mail
---
resources/views/mails/register.blade.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/resources/views/mails/register.blade.php b/resources/views/mails/register.blade.php
index c92d7d3..1f6626c 100644
--- a/resources/views/mails/register.blade.php
+++ b/resources/views/mails/register.blade.php
@@ -27,7 +27,7 @@
À très bientôt,
- L’équipe du Comité des fêtes de Beaupont
+ L’équipe du Comité des fêtes de Beaupont
From 62cb78859cbd253c507139d198bd0e32c4b4ffc0 Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Wed, 18 Mar 2026 10:17:24 +0100
Subject: [PATCH 26/51] improve deactivate account mail
---
resources/views/mails/deactivateAccount.blade.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/resources/views/mails/deactivateAccount.blade.php b/resources/views/mails/deactivateAccount.blade.php
index 03fd4e3..b1010f5 100644
--- a/resources/views/mails/deactivateAccount.blade.php
+++ b/resources/views/mails/deactivateAccount.blade.php
@@ -18,8 +18,8 @@
Vous ne pouvez désormais plus accéder à votre espace personnel ni participer aux activités proposées.
-
- ⚠️ Si vous pensez qu’il s’agit d’une erreur ou si vous souhaitez obtenir plus d’informations,
+
+ Si vous pensez qu’il s’agit d’une erreur ou si vous souhaitez obtenir plus d’informations,
nous vous invitons à contacter l’équipe organisatrice.
From 0057972c2f08a0ca2ba61eee2431e5112ac843f1 Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Wed, 18 Mar 2026 11:07:58 +0100
Subject: [PATCH 27/51] remove unecessary use
---
app/Events/EventParticipationCancelled.php | 3 ---
app/Events/TaskParticipationCancelled.php | 3 ---
app/Events/VolunteerAssignedToTask.php | 3 ---
app/Events/VolunteerUnassignedFromTask.php | 3 ---
4 files changed, 12 deletions(-)
diff --git a/app/Events/EventParticipationCancelled.php b/app/Events/EventParticipationCancelled.php
index 679fe7e..b9fa258 100644
--- a/app/Events/EventParticipationCancelled.php
+++ b/app/Events/EventParticipationCancelled.php
@@ -3,11 +3,8 @@
namespace App\Events;
use App\Models\Events;
-use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
-use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\PrivateChannel;
-use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
diff --git a/app/Events/TaskParticipationCancelled.php b/app/Events/TaskParticipationCancelled.php
index 2a45dd3..d495807 100644
--- a/app/Events/TaskParticipationCancelled.php
+++ b/app/Events/TaskParticipationCancelled.php
@@ -4,11 +4,8 @@ namespace App\Events;
use App\Models\Events;
use App\Models\Task;
-use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
-use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\PrivateChannel;
-use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
diff --git a/app/Events/VolunteerAssignedToTask.php b/app/Events/VolunteerAssignedToTask.php
index 959dc0c..4ba626f 100644
--- a/app/Events/VolunteerAssignedToTask.php
+++ b/app/Events/VolunteerAssignedToTask.php
@@ -4,11 +4,8 @@ namespace App\Events;
use App\Models\Events;
use App\Models\Task;
-use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
-use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\PrivateChannel;
-use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
diff --git a/app/Events/VolunteerUnassignedFromTask.php b/app/Events/VolunteerUnassignedFromTask.php
index 5ff4e43..a1ad129 100644
--- a/app/Events/VolunteerUnassignedFromTask.php
+++ b/app/Events/VolunteerUnassignedFromTask.php
@@ -4,11 +4,8 @@ namespace App\Events;
use App\Models\Events;
use App\Models\Task;
-use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
-use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\PrivateChannel;
-use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
From ce887d084602395fac74a35988b1eb2ff7f25109 Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Wed, 18 Mar 2026 11:33:42 +0100
Subject: [PATCH 28/51] fix broadcast error with event
---
app/Http/Controllers/TasksController.php | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/app/Http/Controllers/TasksController.php b/app/Http/Controllers/TasksController.php
index 55111b8..249cb9f 100644
--- a/app/Http/Controllers/TasksController.php
+++ b/app/Http/Controllers/TasksController.php
@@ -73,8 +73,8 @@ class TasksController extends Controller
}
try {
-
- $task = Task::with('event')->find($request["task_id"]);
+ $task = Task::find($request["task_id"]);
+ $event = \App\Models\Events::find($task->events_id);
if ($task->users()->where('user_id', $id)->exists()) {
return response()->json(["message" => "User already assigned to this task"], 400);
@@ -88,10 +88,11 @@ class TasksController extends Controller
if($user) {
$task->users()->attach($id);
+
broadcast(new VolunteerAssignedToTask(
$user->id,
$task,
- $task->event
+ $event
));
}
@@ -124,7 +125,8 @@ class TasksController extends Controller
}
try {
- $task = Task::with(['users', 'event'])->find($id);
+ $task = Task::with(['users'])->find($id);
+ $event = \App\Models\Events::find($task->events_id);
if (!$task) {
return response()->json(["message" => "Task not found"], 404);
@@ -136,7 +138,7 @@ class TasksController extends Controller
broadcast(new TaskParticipationCancelled(
$user->id,
$task,
- $task->event
+ $event
));
}
@@ -207,7 +209,8 @@ class TasksController extends Controller
}
try {
- $task = Task::with('event')->find($request["task_id"]);
+ $task = Task::find($request["task_id"]);
+ $event = \App\Models\Events::find($task->events_id);
if (!$task) {
return response()->json(["message" => "Task not found"], 404);
@@ -226,7 +229,7 @@ class TasksController extends Controller
broadcast(new VolunteerUnassignedFromTask(
$user->id,
$task,
- $task->event
+ $event
));
}
From 3d8fd6687d086ca4fb6116edbcd923b916550926 Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Wed, 18 Mar 2026 11:37:47 +0100
Subject: [PATCH 29/51] create a mail when a task is deleted to the
participants
---
app/Http/Controllers/TasksController.php | 9 +++
app/Mail/TaskParticipationCancelledMail.php | 59 +++++++++++++++++++
.../taskParticipationCancelled.blade.php | 32 ++++++++++
3 files changed, 100 insertions(+)
create mode 100644 app/Mail/TaskParticipationCancelledMail.php
create mode 100644 resources/views/mails/taskParticipationCancelled.blade.php
diff --git a/app/Http/Controllers/TasksController.php b/app/Http/Controllers/TasksController.php
index 249cb9f..3ed7c34 100644
--- a/app/Http/Controllers/TasksController.php
+++ b/app/Http/Controllers/TasksController.php
@@ -12,6 +12,8 @@ use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Facades\Log;
+use Illuminate\Support\Facades\Mail;
+use App\Mail\TaskParticipationCancelledMail;
class TasksController extends Controller
{
@@ -140,6 +142,13 @@ class TasksController extends Controller
$task,
$event
));
+
+ $data = [
+ 'name' => $user->name,
+ 'lastname' => $user->lastname,
+ 'taskName' => $task->name,
+ ];
+ Mail::to($user->email)->send(new TaskParticipationCancelledMail($data));
}
$task->delete();
diff --git a/app/Mail/TaskParticipationCancelledMail.php b/app/Mail/TaskParticipationCancelledMail.php
new file mode 100644
index 0000000..2120c16
--- /dev/null
+++ b/app/Mail/TaskParticipationCancelledMail.php
@@ -0,0 +1,59 @@
+data = $data;
+ }
+
+ /**
+ * Get the message envelope.
+ */
+ public function envelope(): Envelope
+ {
+ return new Envelope(
+ subject: 'Tâche supprimé - Comité des fêtes de Beaupont',
+ );
+ }
+
+ /**
+ * Get the message content definition.
+ */
+ public function content(): Content
+ {
+ return new Content(
+ view: 'mails.taskParticipationCancelled',
+ with: [
+ 'name' => $this->data['name'],
+ 'lastname' => $this->data['lastname'],
+ 'taskName' => $this->data['taskName'],
+ ]
+ );
+ }
+
+ /**
+ * Get the attachments for the message.
+ *
+ * @return array
+ */
+ public function attachments(): array
+ {
+ return [];
+ }
+}
diff --git a/resources/views/mails/taskParticipationCancelled.blade.php b/resources/views/mails/taskParticipationCancelled.blade.php
new file mode 100644
index 0000000..7eb465b
--- /dev/null
+++ b/resources/views/mails/taskParticipationCancelled.blade.php
@@ -0,0 +1,32 @@
+
+
+
+
+
+ Événement supprimé
+
+
+
+
Bonjour {{ $name }} {{ $lastname }},
+
+
+ La tâche {{ $taskName }} a été supprimé par un administrateur.
+ Vous n’y participez donc plus.
+
+
+
+ Si vous pensez qu’il s’agit d’une erreur ou si vous souhaitez plus d’informations,
+ merci de contacter l’équipe du Comité des fêtes de Beaupont.
+
+
+
+ À très bientôt,
+ L’équipe du Comité des fêtes de Beaupont
+
+
+
+
+ Cet email a été envoyé automatiquement, merci de ne pas y répondre.
+
+
+
From 0c04694c3472eb3e3c3d7f33a1175600892a7c73 Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Wed, 18 Mar 2026 11:44:23 +0100
Subject: [PATCH 30/51] fix spelling in taskParticipationCancelled blade
---
resources/views/mails/taskParticipationCancelled.blade.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/resources/views/mails/taskParticipationCancelled.blade.php b/resources/views/mails/taskParticipationCancelled.blade.php
index 7eb465b..a6e287a 100644
--- a/resources/views/mails/taskParticipationCancelled.blade.php
+++ b/resources/views/mails/taskParticipationCancelled.blade.php
@@ -3,7 +3,7 @@
- Événement supprimé
+ Tâche supprimée
From 2921cbdcbdffaa007fc6609ee88976c041315a5b Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Wed, 18 Mar 2026 11:48:54 +0100
Subject: [PATCH 31/51] create a mail when a user is assigned to a task by an
administrator
---
app/Http/Controllers/TasksController.php | 16 +++--
app/Mail/TaskParticipationCancelledMail.php | 2 +-
app/Mail/VolunteerAssignToTaskMail.php | 61 +++++++++++++++++++
.../mails/volunteerAssignToTask.blade.php | 32 ++++++++++
4 files changed, 104 insertions(+), 7 deletions(-)
create mode 100644 app/Mail/VolunteerAssignToTaskMail.php
create mode 100644 resources/views/mails/volunteerAssignToTask.blade.php
diff --git a/app/Http/Controllers/TasksController.php b/app/Http/Controllers/TasksController.php
index 3ed7c34..b3bc29d 100644
--- a/app/Http/Controllers/TasksController.php
+++ b/app/Http/Controllers/TasksController.php
@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
use App\Events\TaskParticipationCancelled;
use App\Events\VolunteerAssignedToTask;
use App\Events\VolunteerUnassignedFromTask;
+use App\Mail\VolunteerAssignToTaskMail;
use App\Models\Events;
use App\Models\Task;
use App\Models\User;
@@ -96,6 +97,15 @@ class TasksController extends Controller
$task,
$event
));
+
+ $data = [
+ 'name' => $user->name,
+ 'lastname' => $user->lastname,
+ 'taskName' => $task->name,
+ 'start' => $task->start,
+ 'end' => $task->end,
+ ];
+ Mail::to($user->email)->send(new VolunteerAssignToTaskMail($data));
}
return response()->json(['message' => "Task assigned"], 200);
@@ -186,10 +196,6 @@ class TasksController extends Controller
}
}
-
-
-
-
public function unassignSelf(Request $request): JsonResponse {
try {
$task = Task::find($request["task_id"]);
@@ -209,8 +215,6 @@ class TasksController extends Controller
}
}
-
-
public function unassignUser(Request $request, int $id): JsonResponse {
if(Gate::denies('unassignOther', Task::class)) {
diff --git a/app/Mail/TaskParticipationCancelledMail.php b/app/Mail/TaskParticipationCancelledMail.php
index 2120c16..9e59614 100644
--- a/app/Mail/TaskParticipationCancelledMail.php
+++ b/app/Mail/TaskParticipationCancelledMail.php
@@ -28,7 +28,7 @@ class TaskParticipationCancelledMail extends Mailable
public function envelope(): Envelope
{
return new Envelope(
- subject: 'Tâche supprimé - Comité des fêtes de Beaupont',
+ subject: 'Tâche supprimée - Comité des fêtes de Beaupont',
);
}
diff --git a/app/Mail/VolunteerAssignToTaskMail.php b/app/Mail/VolunteerAssignToTaskMail.php
new file mode 100644
index 0000000..a190c78
--- /dev/null
+++ b/app/Mail/VolunteerAssignToTaskMail.php
@@ -0,0 +1,61 @@
+data = $data;
+ }
+
+ /**
+ * Get the message envelope.
+ */
+ public function envelope(): Envelope
+ {
+ return new Envelope(
+ subject: 'Assignation - Comité des fêtes de Beaupont',
+ );
+ }
+
+ /**
+ * Get the message content definition.
+ */
+ public function content(): Content
+ {
+ return new Content(
+ view: 'mails.volunteerAssignToTask',
+ with: [
+ 'name' => $this->data['name'],
+ 'lastname' => $this->data['lastname'],
+ 'taskName' => $this->data['taskName'],
+ 'start' => $this->data['start'],
+ 'end' => $this->data['end'],
+ ]
+ );
+ }
+
+ /**
+ * Get the attachments for the message.
+ *
+ * @return array
+ */
+ public function attachments(): array
+ {
+ return [];
+ }
+}
diff --git a/resources/views/mails/volunteerAssignToTask.blade.php b/resources/views/mails/volunteerAssignToTask.blade.php
new file mode 100644
index 0000000..cfebaba
--- /dev/null
+++ b/resources/views/mails/volunteerAssignToTask.blade.php
@@ -0,0 +1,32 @@
+
+
+
+
+
+ Assignation
+
+
+
+
Bonjour {{ $name }} {{ $lastname }},
+
+
+ Vous avez été assigné à la tâche {{ $taskName }} par un administrateur.
+ Cette tâche aura lieu de {{ $start }} à {{ $end }}.
+
+
+
+ Si vous pensez qu’il s’agit d’une erreur ou si vous souhaitez plus d’informations,
+ merci de contacter l’équipe du Comité des fêtes de Beaupont.
+
+
+
+ À très bientôt,
+ L’équipe du Comité des fêtes de Beaupont
+
+
+
+
+ Cet email a été envoyé automatiquement, merci de ne pas y répondre.
+
+
+
From 92de307017b80390dc91f86b21c39896b67f4b0a Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Wed, 18 Mar 2026 16:14:35 +0100
Subject: [PATCH 32/51] create a mail when a user is unassigned to a task by an
administrator
---
app/Http/Controllers/TasksController.php | 10 +++
app/Mail/VolunteerUnassignToTaskMail.php | 61 +++++++++++++++++++
.../mails/volunteerUnassignToTask.blade.php | 32 ++++++++++
3 files changed, 103 insertions(+)
create mode 100644 app/Mail/VolunteerUnassignToTaskMail.php
create mode 100644 resources/views/mails/volunteerUnassignToTask.blade.php
diff --git a/app/Http/Controllers/TasksController.php b/app/Http/Controllers/TasksController.php
index b3bc29d..f57199c 100644
--- a/app/Http/Controllers/TasksController.php
+++ b/app/Http/Controllers/TasksController.php
@@ -6,6 +6,7 @@ use App\Events\TaskParticipationCancelled;
use App\Events\VolunteerAssignedToTask;
use App\Events\VolunteerUnassignedFromTask;
use App\Mail\VolunteerAssignToTaskMail;
+use App\Mail\VolunteerUnassignToTaskMail;
use App\Models\Events;
use App\Models\Task;
use App\Models\User;
@@ -244,6 +245,15 @@ class TasksController extends Controller
$task,
$event
));
+
+ $data = [
+ 'name' => $user->name,
+ 'lastname' => $user->lastname,
+ 'taskName' => $task->name,
+ 'start' => $task->start,
+ 'end' => $task->end,
+ ];
+ Mail::to($user->email)->send(new VolunteerUnassignToTaskMail($data));
}
return response()->json(['message' => "User unassigned successfully"], 200);
diff --git a/app/Mail/VolunteerUnassignToTaskMail.php b/app/Mail/VolunteerUnassignToTaskMail.php
new file mode 100644
index 0000000..7af6317
--- /dev/null
+++ b/app/Mail/VolunteerUnassignToTaskMail.php
@@ -0,0 +1,61 @@
+data = $data;
+ }
+
+ /**
+ * Get the message envelope.
+ */
+ public function envelope(): Envelope
+ {
+ return new Envelope(
+ subject: 'Désassignation - Comité des fêtes de Beaupont',
+ );
+ }
+
+ /**
+ * Get the message content definition.
+ */
+ public function content(): Content
+ {
+ return new Content(
+ view: 'mails.volunteerUnassignToTask',
+ with: [
+ 'name' => $this->data['name'],
+ 'lastname' => $this->data['lastname'],
+ 'taskName' => $this->data['taskName'],
+ 'start' => $this->data['start'],
+ 'end' => $this->data['end'],
+ ]
+ );
+ }
+
+ /**
+ * Get the attachments for the message.
+ *
+ * @return array
+ */
+ public function attachments(): array
+ {
+ return [];
+ }
+}
diff --git a/resources/views/mails/volunteerUnassignToTask.blade.php b/resources/views/mails/volunteerUnassignToTask.blade.php
new file mode 100644
index 0000000..115747f
--- /dev/null
+++ b/resources/views/mails/volunteerUnassignToTask.blade.php
@@ -0,0 +1,32 @@
+
+
+
+
+
+ Désassignation
+
+
+
+
Bonjour {{ $name }} {{ $lastname }},
+
+
+ Vous avez été désassigné de la tâche {{ $taskName }} par un administrateur.
+ Cette tâche avait lieu de {{ $start }} à {{ $end }}. Vous n'y participez donc plus.
+
+
+
+ Si vous pensez qu’il s’agit d’une erreur ou si vous souhaitez plus d’informations,
+ merci de contacter l’équipe du Comité des fêtes de Beaupont.
+
+
+
+ À très bientôt,
+ L’équipe du Comité des fêtes de Beaupont
+
+
+
+
+ Cet email a été envoyé automatiquement, merci de ne pas y répondre.
+
+
+
From 6c679596bdc8b93b8282cf087a3d27707f003d1f Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Wed, 18 Mar 2026 16:18:12 +0100
Subject: [PATCH 33/51] add date to eventParticipationCancelled mail
---
app/Http/Controllers/EventsController.php | 2 ++
app/Mail/EventParticipationCancelledMail.php | 2 ++
resources/views/mails/eventParticipationCancelled.blade.php | 2 +-
resources/views/mails/volunteerUnassignToTask.blade.php | 2 +-
4 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/app/Http/Controllers/EventsController.php b/app/Http/Controllers/EventsController.php
index 2aed09d..9a321fc 100644
--- a/app/Http/Controllers/EventsController.php
+++ b/app/Http/Controllers/EventsController.php
@@ -108,6 +108,8 @@ class EventsController extends Controller
'name' => $user->name,
'lastname' => $user->lastname,
'eventName' => $event->name,
+ 'start' => $event->start,
+ 'end' => $event->end,
];
Mail::to($user->email)->send(new EventParticipationCancelledMail($data));
diff --git a/app/Mail/EventParticipationCancelledMail.php b/app/Mail/EventParticipationCancelledMail.php
index 2b73159..1255c67 100644
--- a/app/Mail/EventParticipationCancelledMail.php
+++ b/app/Mail/EventParticipationCancelledMail.php
@@ -43,6 +43,8 @@ class EventParticipationCancelledMail extends Mailable
'name' => $this->data['name'],
'lastname' => $this->data['lastname'],
'eventName' => $this->data['eventName'],
+ 'start' => $this->data['start'],
+ 'end' => $this->data['end'],
]
);
}
diff --git a/resources/views/mails/eventParticipationCancelled.blade.php b/resources/views/mails/eventParticipationCancelled.blade.php
index 2c2c8c6..6a0d352 100644
--- a/resources/views/mails/eventParticipationCancelled.blade.php
+++ b/resources/views/mails/eventParticipationCancelled.blade.php
@@ -11,7 +11,7 @@
L’événement {{ $eventName }} a été supprimé par un administrateur.
- Vous n’y participez donc plus.
+ Vous n’y participez donc plus. Cet événement avait lieu de {{ $start }} à {{ $end }}.
diff --git a/resources/views/mails/volunteerUnassignToTask.blade.php b/resources/views/mails/volunteerUnassignToTask.blade.php
index 115747f..d8f65dd 100644
--- a/resources/views/mails/volunteerUnassignToTask.blade.php
+++ b/resources/views/mails/volunteerUnassignToTask.blade.php
@@ -11,7 +11,7 @@
Vous avez été désassigné de la tâche {{ $taskName }} par un administrateur.
- Cette tâche avait lieu de {{ $start }} à {{ $end }}. Vous n'y participez donc plus.
+ Vous n'y participez donc plus. Cette tâche avait lieu de {{ $start }} à {{ $end }}.
From 2ca3100b3c70cc14f837f3d2f3c24b53853dfae9 Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Wed, 18 Mar 2026 16:30:13 +0100
Subject: [PATCH 34/51] create a formatDate service and method
---
app/Services/FormatDate.php | 13 +++++++++++++
1 file changed, 13 insertions(+)
create mode 100644 app/Services/FormatDate.php
diff --git a/app/Services/FormatDate.php b/app/Services/FormatDate.php
new file mode 100644
index 0000000..aece902
--- /dev/null
+++ b/app/Services/FormatDate.php
@@ -0,0 +1,13 @@
+format('d/m/Y, H:i');
+ }
+
+}
From 400d70ff7e9579655f6235f22589340d6a4a2147 Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Wed, 18 Mar 2026 16:30:27 +0100
Subject: [PATCH 35/51] use formatDate method
---
app/Http/Controllers/TasksController.php | 2 ++
app/Mail/EventParticipationCancelledMail.php | 5 +++--
app/Mail/TaskParticipationCancelledMail.php | 3 +++
app/Mail/VolunteerAssignToTaskMail.php | 5 +++--
app/Mail/VolunteerUnassignToTaskMail.php | 5 +++--
resources/views/mails/eventParticipationCancelled.blade.php | 2 +-
resources/views/mails/taskParticipationCancelled.blade.php | 2 +-
resources/views/mails/volunteerAssignToTask.blade.php | 2 +-
resources/views/mails/volunteerUnassignToTask.blade.php | 2 +-
9 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/app/Http/Controllers/TasksController.php b/app/Http/Controllers/TasksController.php
index f57199c..74c06e6 100644
--- a/app/Http/Controllers/TasksController.php
+++ b/app/Http/Controllers/TasksController.php
@@ -158,6 +158,8 @@ class TasksController extends Controller
'name' => $user->name,
'lastname' => $user->lastname,
'taskName' => $task->name,
+ 'start' => $event->start,
+ 'end' => $task->end,
];
Mail::to($user->email)->send(new TaskParticipationCancelledMail($data));
}
diff --git a/app/Mail/EventParticipationCancelledMail.php b/app/Mail/EventParticipationCancelledMail.php
index 1255c67..bcb8e7a 100644
--- a/app/Mail/EventParticipationCancelledMail.php
+++ b/app/Mail/EventParticipationCancelledMail.php
@@ -2,6 +2,7 @@
namespace App\Mail;
+use App\Services\FormatDate;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
@@ -43,8 +44,8 @@ class EventParticipationCancelledMail extends Mailable
'name' => $this->data['name'],
'lastname' => $this->data['lastname'],
'eventName' => $this->data['eventName'],
- 'start' => $this->data['start'],
- 'end' => $this->data['end'],
+ 'start' => FormatDate::formatDate($this->data['start']),
+ 'end' => FormatDate::formatDate($this->data['end']),
]
);
}
diff --git a/app/Mail/TaskParticipationCancelledMail.php b/app/Mail/TaskParticipationCancelledMail.php
index 9e59614..7eeacaf 100644
--- a/app/Mail/TaskParticipationCancelledMail.php
+++ b/app/Mail/TaskParticipationCancelledMail.php
@@ -2,6 +2,7 @@
namespace App\Mail;
+use App\Services\FormatDate;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
@@ -43,6 +44,8 @@ class TaskParticipationCancelledMail extends Mailable
'name' => $this->data['name'],
'lastname' => $this->data['lastname'],
'taskName' => $this->data['taskName'],
+ 'end' => FormatDate::formatDate($this->data['end']),
+ 'start' => FormatDate::formatDate($this->data['start']),
]
);
}
diff --git a/app/Mail/VolunteerAssignToTaskMail.php b/app/Mail/VolunteerAssignToTaskMail.php
index a190c78..99c722b 100644
--- a/app/Mail/VolunteerAssignToTaskMail.php
+++ b/app/Mail/VolunteerAssignToTaskMail.php
@@ -2,6 +2,7 @@
namespace App\Mail;
+use App\Services\FormatDate;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
@@ -43,8 +44,8 @@ class VolunteerAssignToTaskMail extends Mailable
'name' => $this->data['name'],
'lastname' => $this->data['lastname'],
'taskName' => $this->data['taskName'],
- 'start' => $this->data['start'],
- 'end' => $this->data['end'],
+ 'start' => FormatDate::formatDate($this->data['start']),
+ 'end' => FormatDate::formatDate($this->data['end']),
]
);
}
diff --git a/app/Mail/VolunteerUnassignToTaskMail.php b/app/Mail/VolunteerUnassignToTaskMail.php
index 7af6317..506d0c3 100644
--- a/app/Mail/VolunteerUnassignToTaskMail.php
+++ b/app/Mail/VolunteerUnassignToTaskMail.php
@@ -8,6 +8,7 @@ use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
+use App\Services\FormatDate;
class VolunteerUnassignToTaskMail extends Mailable
{
@@ -43,8 +44,8 @@ class VolunteerUnassignToTaskMail extends Mailable
'name' => $this->data['name'],
'lastname' => $this->data['lastname'],
'taskName' => $this->data['taskName'],
- 'start' => $this->data['start'],
- 'end' => $this->data['end'],
+ 'start' => FormatDate::formatDate($this->data['start']),
+ 'end' => FormatDate::formatDate($this->data['end']),
]
);
}
diff --git a/resources/views/mails/eventParticipationCancelled.blade.php b/resources/views/mails/eventParticipationCancelled.blade.php
index 6a0d352..9d2a4c2 100644
--- a/resources/views/mails/eventParticipationCancelled.blade.php
+++ b/resources/views/mails/eventParticipationCancelled.blade.php
@@ -11,7 +11,7 @@
L’événement {{ $eventName }} a été supprimé par un administrateur.
- Vous n’y participez donc plus. Cet événement avait lieu de {{ $start }} à {{ $end }}.
+ Vous n’y participez donc plus. Cet événement avait lieu du {{ $start }} au {{ $end }}.
diff --git a/resources/views/mails/taskParticipationCancelled.blade.php b/resources/views/mails/taskParticipationCancelled.blade.php
index a6e287a..861520c 100644
--- a/resources/views/mails/taskParticipationCancelled.blade.php
+++ b/resources/views/mails/taskParticipationCancelled.blade.php
@@ -11,7 +11,7 @@
La tâche {{ $taskName }} a été supprimé par un administrateur.
- Vous n’y participez donc plus.
+ Vous n’y participez donc plus. Cette tâche avait lieu du {{ $start }} au {{ $end }}.
diff --git a/resources/views/mails/volunteerAssignToTask.blade.php b/resources/views/mails/volunteerAssignToTask.blade.php
index cfebaba..55c4057 100644
--- a/resources/views/mails/volunteerAssignToTask.blade.php
+++ b/resources/views/mails/volunteerAssignToTask.blade.php
@@ -11,7 +11,7 @@
Vous avez été assigné à la tâche {{ $taskName }} par un administrateur.
- Cette tâche aura lieu de {{ $start }} à {{ $end }}.
+ Cette tâche aura lieu du {{ $start }} au {{ $end }}.
diff --git a/resources/views/mails/volunteerUnassignToTask.blade.php b/resources/views/mails/volunteerUnassignToTask.blade.php
index d8f65dd..052c68e 100644
--- a/resources/views/mails/volunteerUnassignToTask.blade.php
+++ b/resources/views/mails/volunteerUnassignToTask.blade.php
@@ -11,7 +11,7 @@
Vous avez été désassigné de la tâche {{ $taskName }} par un administrateur.
- Vous n'y participez donc plus. Cette tâche avait lieu de {{ $start }} à {{ $end }}.
+ Vous n'y participez donc plus. Cette tâche avait lieu du {{ $start }} au {{ $end }}.
From 69660270965a641f055451890775fe0808a6f9be Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Thu, 19 Mar 2026 08:41:07 +0100
Subject: [PATCH 36/51] check if the event is future or ongoing to send email
and notification on deletion
---
app/Http/Controllers/EventsController.php | 33 ++++++++++++-----------
1 file changed, 18 insertions(+), 15 deletions(-)
diff --git a/app/Http/Controllers/EventsController.php b/app/Http/Controllers/EventsController.php
index 9a321fc..e12d8b8 100644
--- a/app/Http/Controllers/EventsController.php
+++ b/app/Http/Controllers/EventsController.php
@@ -4,7 +4,6 @@ namespace App\Http\Controllers;
use App\Events\EventParticipationCancelled;
use App\Mail\EventParticipationCancelledMail;
-use App\Mail\ValidateMail;
use App\Models\Events;
use App\Models\Task;
use Illuminate\Http\Request;
@@ -12,6 +11,7 @@ use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Mail;
+use Carbon\Carbon;
class EventsController extends Controller
@@ -89,6 +89,8 @@ class EventsController extends Controller
try {
$event = Events::with('tasks.users')->find($id);
+ Log::info($event);
+ Log::info($event->tasks);
if (!$event) {
return response()->json(['message' => 'Event not found'], 404);
@@ -98,21 +100,22 @@ class EventsController extends Controller
return $task->users;
})->unique('id');
- foreach ($participants as $user) {
- broadcast(new EventParticipationCancelled(
- $user->id,
- $event
- ));
-
- $data = [
- 'name' => $user->name,
- 'lastname' => $user->lastname,
- 'eventName' => $event->name,
- 'start' => $event->start,
- 'end' => $event->end,
- ];
- Mail::to($user->email)->send(new EventParticipationCancelledMail($data));
+ if (Carbon::now()->lessThanOrEqualTo($event->end)) {
+ foreach ($participants as $user) {
+ broadcast(new EventParticipationCancelled(
+ $user->id,
+ $event
+ ));
+ $data = [
+ 'name' => $user->name,
+ 'lastname' => $user->lastname,
+ 'eventName' => $event->name,
+ 'start' => $event->start,
+ 'end' => $event->end,
+ ];
+ Mail::to($user->email)->send(new EventParticipationCancelledMail($data));
+ }
}
$event->delete();
From 77d3efc5557ba73d7447ec0220924ba9d385ed49 Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Thu, 19 Mar 2026 08:42:20 +0100
Subject: [PATCH 37/51] check if the task is future or ongoing to send email
and notification on deletion
---
app/Http/Controllers/TasksController.php | 31 +++++++++++++-----------
1 file changed, 17 insertions(+), 14 deletions(-)
diff --git a/app/Http/Controllers/TasksController.php b/app/Http/Controllers/TasksController.php
index 74c06e6..30c061e 100644
--- a/app/Http/Controllers/TasksController.php
+++ b/app/Http/Controllers/TasksController.php
@@ -10,6 +10,7 @@ use App\Mail\VolunteerUnassignToTaskMail;
use App\Models\Events;
use App\Models\Task;
use App\Models\User;
+use Carbon\Carbon;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Gate;
@@ -147,21 +148,23 @@ class TasksController extends Controller
$participants = $task->users;
- foreach ($participants as $user) {
- broadcast(new TaskParticipationCancelled(
- $user->id,
- $task,
- $event
- ));
+ if (Carbon::now()->lessThanOrEqualTo($task->end)) {
+ foreach ($participants as $user) {
+ broadcast(new TaskParticipationCancelled(
+ $user->id,
+ $task,
+ $event
+ ));
- $data = [
- 'name' => $user->name,
- 'lastname' => $user->lastname,
- 'taskName' => $task->name,
- 'start' => $event->start,
- 'end' => $task->end,
- ];
- Mail::to($user->email)->send(new TaskParticipationCancelledMail($data));
+ $data = [
+ 'name' => $user->name,
+ 'lastname' => $user->lastname,
+ 'taskName' => $task->name,
+ 'start' => $event->start,
+ 'end' => $task->end,
+ ];
+ Mail::to($user->email)->send(new TaskParticipationCancelledMail($data));
+ }
}
$task->delete();
From 5d256637ecfcd184417465572bafa1dd36668d3e Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Thu, 19 Mar 2026 08:43:53 +0100
Subject: [PATCH 38/51] check if the task is future or ongoing to send email
and notification on assign user
---
app/Http/Controllers/TasksController.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/Http/Controllers/TasksController.php b/app/Http/Controllers/TasksController.php
index 30c061e..abb76bf 100644
--- a/app/Http/Controllers/TasksController.php
+++ b/app/Http/Controllers/TasksController.php
@@ -91,7 +91,7 @@ class TasksController extends Controller
$user = User::find($id);
- if($user) {
+ if($user && Carbon::now()->lessThanOrEqualTo($task->end)) {
$task->users()->attach($id);
broadcast(new VolunteerAssignedToTask(
From ad6a0f6e90e44ee0aeb2d546eed0dd0dd9f2b4fc Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Thu, 19 Mar 2026 08:44:12 +0100
Subject: [PATCH 39/51] check if the task is future or ongoing to send email
and notification on unassign user
---
app/Http/Controllers/TasksController.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/Http/Controllers/TasksController.php b/app/Http/Controllers/TasksController.php
index abb76bf..b456470 100644
--- a/app/Http/Controllers/TasksController.php
+++ b/app/Http/Controllers/TasksController.php
@@ -242,7 +242,7 @@ class TasksController extends Controller
$user = User::find($id);
- if ($user) {
+ if ($user && Carbon::now()->lessThanOrEqualTo($task->end)) {
$task->users()->detach($id);
broadcast(new VolunteerUnassignedFromTask(
From 0e5d6a12704b04dcc54c12e31d92bf9b17de9e60 Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Thu, 19 Mar 2026 10:00:18 +0100
Subject: [PATCH 40/51] merge dev into features/notifications
---
config/cors.php | 4 ----
1 file changed, 4 deletions(-)
diff --git a/config/cors.php b/config/cors.php
index 8287cbf..19f2551 100644
--- a/config/cors.php
+++ b/config/cors.php
@@ -20,13 +20,9 @@ return [
'allowed_methods' => ['*'],
-<<<<<<< HEAD
'allowed_origins' => env('DEV', 0) == 1
? explode(',', env('DEV_CORS_ALLOWED_ORIGINS'))
: explode(',', env('PROD_CORS_ALLOWED_ORIGINS')),
-=======
- 'allowed_origins' => ['*'],
->>>>>>> dev
'allowed_origins_patterns' => [],
From 4ebb1ad6c0419431da4fc2f6dc657d6549a6a544 Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Thu, 19 Mar 2026 10:22:59 +0100
Subject: [PATCH 41/51] fix attribut name
---
app/Http/Controllers/EventsController.php | 4 +---
app/Http/Controllers/TasksController.php | 2 +-
app/Models/Event.php | 2 +-
database/migrations/2025_11_09_144248_create_tasks_table.php | 2 +-
4 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/app/Http/Controllers/EventsController.php b/app/Http/Controllers/EventsController.php
index d369ccd..3789467 100644
--- a/app/Http/Controllers/EventsController.php
+++ b/app/Http/Controllers/EventsController.php
@@ -68,9 +68,8 @@ class EventsController extends Controller
}
public function getEvents(Request $request): JsonResponse {
-
+ Log::info('ok');
try {
-
$events = Event::with('tasks')->get();
return response()->json(['data' => $events]);
@@ -132,7 +131,6 @@ class EventsController extends Controller
}
public function getEvent(Request $request, int $id): JsonResponse {
-
try {
$event = Event::find($id);
diff --git a/app/Http/Controllers/TasksController.php b/app/Http/Controllers/TasksController.php
index 7b0a604..d9626d9 100644
--- a/app/Http/Controllers/TasksController.php
+++ b/app/Http/Controllers/TasksController.php
@@ -29,7 +29,7 @@ class TasksController extends Controller
try {
- $event = Event::find($request["event_id"]);
+ $event = Event::find($request["events_id"]);
$event->tasks()->create([
"name" => $request["name"],
diff --git a/app/Models/Event.php b/app/Models/Event.php
index 8709fb0..b4feeef 100644
--- a/app/Models/Event.php
+++ b/app/Models/Event.php
@@ -16,6 +16,6 @@ class Event extends Model
];
public function tasks() {
- return $this->hasMany(Task::class);
+ return $this->hasMany(Task::class, 'events_id');
}
}
diff --git a/database/migrations/2025_11_09_144248_create_tasks_table.php b/database/migrations/2025_11_09_144248_create_tasks_table.php
index b8c6363..e6ce615 100644
--- a/database/migrations/2025_11_09_144248_create_tasks_table.php
+++ b/database/migrations/2025_11_09_144248_create_tasks_table.php
@@ -21,7 +21,7 @@ return new class extends Migration
$table->dateTime("end");
$table->integer('max_participants');
- $table->foreignId("event_id")->constrained("events")->onDelete("cascade");
+ $table->foreignId("events_id")->constrained("events")->onDelete("cascade");
$table->timestamps();
});
From bda5aa4d508ffb41a89179a0b9ede34d87bbdf03 Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Thu, 19 Mar 2026 17:02:27 +0100
Subject: [PATCH 42/51] remove debug Log::info
---
app/Http/Controllers/EventsController.php | 1 -
1 file changed, 1 deletion(-)
diff --git a/app/Http/Controllers/EventsController.php b/app/Http/Controllers/EventsController.php
index 3789467..117398e 100644
--- a/app/Http/Controllers/EventsController.php
+++ b/app/Http/Controllers/EventsController.php
@@ -68,7 +68,6 @@ class EventsController extends Controller
}
public function getEvents(Request $request): JsonResponse {
- Log::info('ok');
try {
$events = Event::with('tasks')->get();
From 16ae03e6e69e29a6513bce1b719ba6222e6c8aed Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Thu, 19 Mar 2026 17:11:34 +0100
Subject: [PATCH 43/51] create broadcast notification when the user role is
updated
---
app/Events/VolunteerRoleUpdated.php | 45 +++++++++++++++++++++++++
app/Http/Controllers/UserController.php | 8 ++++-
2 files changed, 52 insertions(+), 1 deletion(-)
create mode 100644 app/Events/VolunteerRoleUpdated.php
diff --git a/app/Events/VolunteerRoleUpdated.php b/app/Events/VolunteerRoleUpdated.php
new file mode 100644
index 0000000..e73bd47
--- /dev/null
+++ b/app/Events/VolunteerRoleUpdated.php
@@ -0,0 +1,45 @@
+userId = $userId;
+ $this->role = $role;
+ }
+
+ /**
+ * Get the channels the event should broadcast on.
+ *
+ * @return array
+ */
+ public function broadcastOn(): array
+ {
+ return [
+ new PrivateChannel('user.' . $this->userId),
+ ];
+ }
+
+ public function broadcastAs()
+ {
+ return 'volunteer.role.updated';
+ }
+}
diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php
index d93a542..f58ba6b 100644
--- a/app/Http/Controllers/UserController.php
+++ b/app/Http/Controllers/UserController.php
@@ -3,6 +3,7 @@
namespace App\Http\Controllers;
use App\Events\UserCreated;
+use App\Events\VolunteerRoleUpdated;
use App\Mail\CreateUserByAdminMail;
use App\Mail\DeactivateAccountMail;
use App\Mail\DeleteAccountMail;
@@ -255,10 +256,15 @@ class UserController extends Controller
$role = \App\Services\GetRole::getRole($request['role']);
$notification = Notification::create([
- 'content' => "Votre rôle à changé pour {$role} !",
+ 'content' => "Votre rôle à changé pour : {$role} !",
]);
$notification->users()->attach($user->id);
+ broadcast(new VolunteerRoleUpdated(
+ $user->id,
+ $role
+ ));
+
$data = [
'name' => $user->name,
'lastname' => $user->lastname,
From 6a825db6081c4557093c452cd9ff2735a7f14491 Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Thu, 19 Mar 2026 17:37:55 +0100
Subject: [PATCH 44/51] create notification, broadcast notification and mail
when a futur or ongoing date of a task is updated
---
app/Events/TaskDateUpdated.php | 45 +++++++++++++
app/Http/Controllers/TasksController.php | 47 ++++++++++++--
app/Mail/TaskDateUpdateMail.php | 64 +++++++++++++++++++
.../views/mails/taskDateUpdate.blade.php | 32 ++++++++++
4 files changed, 184 insertions(+), 4 deletions(-)
create mode 100644 app/Events/TaskDateUpdated.php
create mode 100644 app/Mail/TaskDateUpdateMail.php
create mode 100644 resources/views/mails/taskDateUpdate.blade.php
diff --git a/app/Events/TaskDateUpdated.php b/app/Events/TaskDateUpdated.php
new file mode 100644
index 0000000..af928d2
--- /dev/null
+++ b/app/Events/TaskDateUpdated.php
@@ -0,0 +1,45 @@
+userId = $userId;
+ $this->task = $task;
+ }
+
+ /**
+ * Get the channels the event should broadcast on.
+ *
+ * @return array
+ */
+ public function broadcastOn(): array
+ {
+ return [
+ new PrivateChannel('user.' . $this->userId),
+ ];
+ }
+
+ public function broadcastAs()
+ {
+ return 'task.date.updated';
+ }
+}
diff --git a/app/Http/Controllers/TasksController.php b/app/Http/Controllers/TasksController.php
index d9626d9..e5a90d7 100644
--- a/app/Http/Controllers/TasksController.php
+++ b/app/Http/Controllers/TasksController.php
@@ -2,9 +2,11 @@
namespace App\Http\Controllers;
+use App\Events\TaskDateUpdated;
use App\Events\TaskParticipationCancelled;
use App\Events\VolunteerAssignedToTask;
use App\Events\VolunteerUnassignedFromTask;
+use App\Mail\TaskDateUpdateMail;
use App\Models\Event;
use App\Models\Notification;
use App\Mail\VolunteerAssignToTaskMail;
@@ -18,6 +20,7 @@ use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Mail;
use App\Mail\TaskParticipationCancelledMail;
+use App\Services\FormatDate;
class TasksController extends Controller
{
@@ -80,7 +83,7 @@ class TasksController extends Controller
try {
$task = Task::find($request["task_id"]);
- $event = \App\Models\Event::find($task->events_id);
+ $event = Event::find($task->events_id);
if ($task->users()->where('user_id', $id)->exists()) {
return response()->json(["message" => "User already assigned to this task"], 400);
@@ -112,6 +115,7 @@ class TasksController extends Controller
'taskName' => $task->name,
'start' => $task->start,
'end' => $task->end,
+ 'eventName' => $event->name,
];
Mail::to($user->email)->send(new VolunteerAssignToTaskMail($data));
}
@@ -146,7 +150,7 @@ class TasksController extends Controller
try {
$task = Task::with(['users'])->find($id);
- $event = \App\Models\Event::find($task->events_id);
+ $event = Event::find($task->events_id);
if (!$task) {
return response()->json(["message" => "Task not found"], 404);
@@ -175,6 +179,7 @@ class TasksController extends Controller
'taskName' => $task->name,
'start' => $event->start,
'end' => $task->end,
+ 'eventName' => $event->name,
];
Mail::to($user->email)->send(new TaskParticipationCancelledMail($data));
}
@@ -197,8 +202,41 @@ class TasksController extends Controller
}
try {
-
$task = Task::find($id);
+ if((
+ $task->start !== $request["start"] || $task->end !== $request["end"]
+ ) &&
+ Carbon::now()->lessThanOrEqualTo($task->end)
+ ){
+ $participants = $task->users;
+ $formatedTaskStart = FormatDate::formatDate($task->start);
+ $formatedTaskEnd = FormatDate::formatDate($task->end);
+ $event = Event::find($task->events_id);
+
+ foreach ($participants as $user) {
+ $notification = Notification::create([
+ 'content' => "La date de la tâche {$task->title} de l'événement {$task->event->name} à été mis à jour. Cette tâche aura maintenant lieu du {$formatedTaskStart} au {$formatedTaskEnd}."
+ ]);
+ $notification->users()->attach($user->id);
+ broadcast(new TaskDateUpdated(
+ $user->id,
+ $task,
+ ));
+
+ $data = [
+ 'name' => $user->name,
+ 'lastname' => $user->lastname,
+ 'taskName' => $task->name,
+ 'oldStart' => $formatedTaskStart,
+ 'oldEnd' => $formatedTaskEnd,
+ 'newStart' => $request["start"],
+ 'newEnd' => $request["end"],
+ 'eventName' => $event->name,
+ ];
+ Mail::to($user->email)->send(new TaskDateUpdateMail($data));
+ }
+ }
+
$task->name = $request["name"];
$task->description = $request["description"];
$task->start = $request["start"];
@@ -242,7 +280,7 @@ class TasksController extends Controller
try {
$task = Task::find($request["task_id"]);
- $event = \App\Models\Event::find($task->events_id);
+ $event = Event::find($task->events_id);
if (!$task) {
return response()->json(["message" => "Task not found"], 404);
@@ -273,6 +311,7 @@ class TasksController extends Controller
'taskName' => $task->name,
'start' => $task->start,
'end' => $task->end,
+ 'eventName' => $event->name,
];
Mail::to($user->email)->send(new VolunteerUnassignToTaskMail($data));
}
diff --git a/app/Mail/TaskDateUpdateMail.php b/app/Mail/TaskDateUpdateMail.php
new file mode 100644
index 0000000..6405074
--- /dev/null
+++ b/app/Mail/TaskDateUpdateMail.php
@@ -0,0 +1,64 @@
+data = $data;
+ }
+
+ /**
+ * Get the message envelope.
+ */
+ public function envelope(): Envelope
+ {
+ return new Envelope(
+ subject: 'Date de tâche modifiée - Comité des fêtes de Beaupont',
+ );
+ }
+
+ /**
+ * Get the message content definition.
+ */
+ public function content(): Content
+ {
+ return new Content(
+ view: 'mails.updateRole',
+ with: [
+ 'name' => $this->data['name'],
+ 'lastname' => $this->data['lastname'],
+ 'taskName' => $this->data['taskName'],
+ 'oldStart' => $this->data['oldStart'],
+ 'oldEnd' => $this->data['oldEnd'],
+ 'newStart' => $this->data['newStart'],
+ 'newEnd' => $this->data['newEnd'],
+ 'eventName' => $this->data['eventName'],
+ ]
+ );
+ }
+
+ /**
+ * Get the attachments for the message.
+ *
+ * @return array
+ */
+ public function attachments(): array
+ {
+ return [];
+ }
+}
diff --git a/resources/views/mails/taskDateUpdate.blade.php b/resources/views/mails/taskDateUpdate.blade.php
new file mode 100644
index 0000000..2f48e99
--- /dev/null
+++ b/resources/views/mails/taskDateUpdate.blade.php
@@ -0,0 +1,32 @@
+
+
+
+
+
+ Date de tâche modifiée
+
+
+
+
Bonjour {{ $name }} {{ $lastname }},
+
+
+ La date de la tâche {{ $taskName }} de l'événement {{ $eventName }} a été modifié par un administrateur.
+ Cette tâche avait lieu du {{ $oldStart }} au {{ $oldEnd }}. Et aura maintenant lieu du {{ $newStart }} au {{ $newEnd }}.
+
+
+
+ Si vous pensez qu’il s’agit d’une erreur ou si vous souhaitez plus d’informations,
+ merci de contacter l’équipe du Comité des fêtes de Beaupont.
+
+
+
+ À très bientôt,
+ L’équipe du Comité des fêtes de Beaupont
+
+
+
+
+ Cet email a été envoyé automatiquement, merci de ne pas y répondre.
+
+
+
From 8371f96388f8e2eeaae8033126c1adcf6fcd7a5f Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Thu, 19 Mar 2026 17:38:06 +0100
Subject: [PATCH 45/51] add event name in mail
---
app/Mail/TaskParticipationCancelledMail.php | 1 +
app/Mail/VolunteerAssignToTaskMail.php | 1 +
app/Mail/VolunteerUnassignToTaskMail.php | 1 +
resources/views/mails/taskParticipationCancelled.blade.php | 2 +-
resources/views/mails/volunteerAssignToTask.blade.php | 2 +-
resources/views/mails/volunteerUnassignToTask.blade.php | 2 +-
6 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/app/Mail/TaskParticipationCancelledMail.php b/app/Mail/TaskParticipationCancelledMail.php
index 7eeacaf..b5a390d 100644
--- a/app/Mail/TaskParticipationCancelledMail.php
+++ b/app/Mail/TaskParticipationCancelledMail.php
@@ -46,6 +46,7 @@ class TaskParticipationCancelledMail extends Mailable
'taskName' => $this->data['taskName'],
'end' => FormatDate::formatDate($this->data['end']),
'start' => FormatDate::formatDate($this->data['start']),
+ 'eventName' => $this->data['eventName'],
]
);
}
diff --git a/app/Mail/VolunteerAssignToTaskMail.php b/app/Mail/VolunteerAssignToTaskMail.php
index 99c722b..9fa1681 100644
--- a/app/Mail/VolunteerAssignToTaskMail.php
+++ b/app/Mail/VolunteerAssignToTaskMail.php
@@ -46,6 +46,7 @@ class VolunteerAssignToTaskMail extends Mailable
'taskName' => $this->data['taskName'],
'start' => FormatDate::formatDate($this->data['start']),
'end' => FormatDate::formatDate($this->data['end']),
+ 'eventName' => $this->data['eventName'],
]
);
}
diff --git a/app/Mail/VolunteerUnassignToTaskMail.php b/app/Mail/VolunteerUnassignToTaskMail.php
index 506d0c3..b4c5305 100644
--- a/app/Mail/VolunteerUnassignToTaskMail.php
+++ b/app/Mail/VolunteerUnassignToTaskMail.php
@@ -46,6 +46,7 @@ class VolunteerUnassignToTaskMail extends Mailable
'taskName' => $this->data['taskName'],
'start' => FormatDate::formatDate($this->data['start']),
'end' => FormatDate::formatDate($this->data['end']),
+ 'eventName' => $this->data['eventName'],
]
);
}
diff --git a/resources/views/mails/taskParticipationCancelled.blade.php b/resources/views/mails/taskParticipationCancelled.blade.php
index 861520c..922b087 100644
--- a/resources/views/mails/taskParticipationCancelled.blade.php
+++ b/resources/views/mails/taskParticipationCancelled.blade.php
@@ -10,7 +10,7 @@
Bonjour {{ $name }} {{ $lastname }},
- La tâche {{ $taskName }} a été supprimé par un administrateur.
+ La tâche {{ $taskName }} de l'événement {{ $eventName }} a été supprimé par un administrateur.
Vous n’y participez donc plus. Cette tâche avait lieu du {{ $start }} au {{ $end }}.
diff --git a/resources/views/mails/volunteerAssignToTask.blade.php b/resources/views/mails/volunteerAssignToTask.blade.php
index 55c4057..e084dc7 100644
--- a/resources/views/mails/volunteerAssignToTask.blade.php
+++ b/resources/views/mails/volunteerAssignToTask.blade.php
@@ -10,7 +10,7 @@
Bonjour {{ $name }} {{ $lastname }},
- Vous avez été assigné à la tâche {{ $taskName }} par un administrateur.
+ Vous avez été assigné à la tâche {{ $taskName }} de l'événément {{ $eventName }} par un administrateur.
Cette tâche aura lieu du {{ $start }} au {{ $end }}.
diff --git a/resources/views/mails/volunteerUnassignToTask.blade.php b/resources/views/mails/volunteerUnassignToTask.blade.php
index 052c68e..d97dce0 100644
--- a/resources/views/mails/volunteerUnassignToTask.blade.php
+++ b/resources/views/mails/volunteerUnassignToTask.blade.php
@@ -10,7 +10,7 @@
Bonjour {{ $name }} {{ $lastname }},
- Vous avez été désassigné de la tâche {{ $taskName }} par un administrateur.
+ Vous avez été désassigné de la tâche {{ $taskName }} de l'événement {{ $eventName }} par un administrateur.
Vous n'y participez donc plus. Cette tâche avait lieu du {{ $start }} au {{ $end }}.
From cf2a29a863929ab4bba7a74faf3671aa92983317 Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Thu, 19 Mar 2026 17:43:02 +0100
Subject: [PATCH 46/51] rename $task->title into $task->name
---
app/Http/Controllers/TasksController.php | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/app/Http/Controllers/TasksController.php b/app/Http/Controllers/TasksController.php
index e5a90d7..5caf9bd 100644
--- a/app/Http/Controllers/TasksController.php
+++ b/app/Http/Controllers/TasksController.php
@@ -99,7 +99,7 @@ class TasksController extends Controller
$task->users()->attach($id);
$notification = Notification::create([
- 'content' => "Vous avez été assigné à la tâche {$task->title} de l'événement {$task->event->name}."
+ 'content' => "Vous avez été assigné à la tâche {$task->name} de l'événement {$task->event->name}."
]);
$notification->users()->attach($user->id);
@@ -161,7 +161,7 @@ class TasksController extends Controller
if (Carbon::now()->lessThanOrEqualTo($task->end)) {
if ($participants->isNotEmpty()) {
$notification = Notification::create([
- 'content' => "La tâche '{$task->title}' pour l'événement '{$task->event->name}' a été supprimée. Vous n'y participez donc plus."
+ 'content' => "La tâche '{$task->name}' pour l'événement '{$task->event->name}' a été supprimée. Vous n'y participez donc plus."
]);
$notification->users()->attach($participants->pluck('id'));
}
@@ -215,7 +215,7 @@ class TasksController extends Controller
foreach ($participants as $user) {
$notification = Notification::create([
- 'content' => "La date de la tâche {$task->title} de l'événement {$task->event->name} à été mis à jour. Cette tâche aura maintenant lieu du {$formatedTaskStart} au {$formatedTaskEnd}."
+ 'content' => "La date de la tâche {$task->name} de l'événement {$task->event->name} à été mis à jour. Cette tâche aura maintenant lieu du {$formatedTaskStart} au {$formatedTaskEnd}."
]);
$notification->users()->attach($user->id);
broadcast(new TaskDateUpdated(
@@ -296,7 +296,7 @@ class TasksController extends Controller
if ($user && Carbon::now()->lessThanOrEqualTo($task->end)) {
$task->users()->detach($id);
$notification = Notification::create([
- 'content' => "Vous avez été désassigné de la tâche {$task->title} de l'événement {$task->event->name}."
+ 'content' => "Vous avez été désassigné de la tâche {$task->name} de l'événement {$task->event->name}."
]);
$notification->users()->attach($user->id);
broadcast(new VolunteerUnassignedFromTask(
From d627afdeaf7daada75c59237a99457bb791c5a91 Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Thu, 19 Mar 2026 17:49:41 +0100
Subject: [PATCH 47/51] add information in task date updated notification
---
app/Events/TaskDateUpdated.php | 8 +++++++-
app/Http/Controllers/TasksController.php | 5 ++++-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/app/Events/TaskDateUpdated.php b/app/Events/TaskDateUpdated.php
index af928d2..9526a5b 100644
--- a/app/Events/TaskDateUpdated.php
+++ b/app/Events/TaskDateUpdated.php
@@ -15,15 +15,21 @@ class TaskDateUpdated implements ShouldBroadcastNow
use Dispatchable, InteractsWithSockets, SerializesModels;
public $task;
+ public $event;
+ public $start;
+ public $end;
protected $userId;
/**
* Create a new event instance.
*/
- public function __construct($userId, Task $task)
+ public function __construct($userId, Task $task, Event $event, $start, $end)
{
$this->userId = $userId;
$this->task = $task;
+ $this->event = $event;
+ $this->start = $start;
+ $this->end = $end;
}
/**
diff --git a/app/Http/Controllers/TasksController.php b/app/Http/Controllers/TasksController.php
index 5caf9bd..c13e117 100644
--- a/app/Http/Controllers/TasksController.php
+++ b/app/Http/Controllers/TasksController.php
@@ -215,12 +215,15 @@ class TasksController extends Controller
foreach ($participants as $user) {
$notification = Notification::create([
- 'content' => "La date de la tâche {$task->name} de l'événement {$task->event->name} à été mis à jour. Cette tâche aura maintenant lieu du {$formatedTaskStart} au {$formatedTaskEnd}."
+ 'content' => "La date de la tâche {$task->name} de l'événement {$event->name} à été mis à jour. Cette tâche aura maintenant lieu du {$formatedTaskStart} au {$formatedTaskEnd}."
]);
$notification->users()->attach($user->id);
broadcast(new TaskDateUpdated(
$user->id,
$task,
+ $event,
+ $newStart,
+ $newEnd,
));
$data = [
From b7ccc38b688cbffede31157ab3858342ed7e79eb Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Thu, 19 Mar 2026 17:51:18 +0100
Subject: [PATCH 48/51] add information in task date updated notification
---
app/Http/Controllers/TasksController.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/Http/Controllers/TasksController.php b/app/Http/Controllers/TasksController.php
index c13e117..c5b7936 100644
--- a/app/Http/Controllers/TasksController.php
+++ b/app/Http/Controllers/TasksController.php
@@ -222,8 +222,8 @@ class TasksController extends Controller
$user->id,
$task,
$event,
- $newStart,
- $newEnd,
+ FormatDate::formatDate($request["start"]),
+ FormatDate::formatDate($request["end"]),
));
$data = [
From ec76ca981a37c35a967b3711c2211c6476e1af9d Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Thu, 19 Mar 2026 18:01:55 +0100
Subject: [PATCH 49/51] add information in notifications
---
app/Http/Controllers/TasksController.php | 12 ++++++------
app/Http/Controllers/UserController.php | 5 +++--
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/app/Http/Controllers/TasksController.php b/app/Http/Controllers/TasksController.php
index c5b7936..e08bd52 100644
--- a/app/Http/Controllers/TasksController.php
+++ b/app/Http/Controllers/TasksController.php
@@ -99,14 +99,14 @@ class TasksController extends Controller
$task->users()->attach($id);
$notification = Notification::create([
- 'content' => "Vous avez été assigné à la tâche {$task->name} de l'événement {$task->event->name}."
+ 'content' => "Vous avez été assigné à la tâche {$task->name} de l'événement {$event->name}."
]);
$notification->users()->attach($user->id);
broadcast(new VolunteerAssignedToTask(
$user->id,
$task,
- $event
+ $event,
));
$data = [
@@ -161,7 +161,7 @@ class TasksController extends Controller
if (Carbon::now()->lessThanOrEqualTo($task->end)) {
if ($participants->isNotEmpty()) {
$notification = Notification::create([
- 'content' => "La tâche '{$task->name}' pour l'événement '{$task->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'));
}
@@ -170,7 +170,7 @@ class TasksController extends Controller
broadcast(new TaskParticipationCancelled(
$user->id,
$task,
- $event
+ $event,
));
$data = [
@@ -299,13 +299,13 @@ class TasksController extends Controller
if ($user && Carbon::now()->lessThanOrEqualTo($task->end)) {
$task->users()->detach($id);
$notification = Notification::create([
- 'content' => "Vous avez été désassigné de la tâche {$task->name} de l'événement {$task->event->name}."
+ 'content' => "Vous avez été désassigné de la tâche {$task->name} de l'événement {$event->name}."
]);
$notification->users()->attach($user->id);
broadcast(new VolunteerUnassignedFromTask(
$user->id,
$task,
- $event
+ $event,
));
$data = [
diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php
index f58ba6b..58e6772 100644
--- a/app/Http/Controllers/UserController.php
+++ b/app/Http/Controllers/UserController.php
@@ -12,6 +12,7 @@ use App\Mail\UpdateRoleMail;
use App\Mail\ValidateMail;
use App\Models\Notification;
use App\Models\User;
+use App\Services\GetRole;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
@@ -253,10 +254,10 @@ class UserController extends Controller
$user->role = $request['role'];
$user->save();
- $role = \App\Services\GetRole::getRole($request['role']);
+ $role = GetRole::getRole($request['role']);
$notification = Notification::create([
- 'content' => "Votre rôle à changé pour : {$role} !",
+ 'content' => "Votre rôle à changé pour : {$role}",
]);
$notification->users()->attach($user->id);
From 9fbc09017b8f613552084d6df1acfcbe05c7cce3 Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Thu, 19 Mar 2026 18:09:11 +0100
Subject: [PATCH 50/51] add $notificationId to every broadcast notification
---
app/Events/EventParticipationCancelled.php | 4 +++-
app/Events/TaskDateUpdated.php | 4 +++-
app/Events/TaskParticipationCancelled.php | 4 +++-
app/Events/UserCreated.php | 4 +++-
app/Events/VolunteerAssignedToTask.php | 4 +++-
app/Events/VolunteerRoleUpdated.php | 4 +++-
app/Events/VolunteerUnassignedFromTask.php | 4 +++-
app/Http/Controllers/EventsController.php | 3 ++-
app/Http/Controllers/TasksController.php | 4 ++++
app/Http/Controllers/UserController.php | 8 ++++++--
10 files changed, 33 insertions(+), 10 deletions(-)
diff --git a/app/Events/EventParticipationCancelled.php b/app/Events/EventParticipationCancelled.php
index 23f04f0..015ba90 100644
--- a/app/Events/EventParticipationCancelled.php
+++ b/app/Events/EventParticipationCancelled.php
@@ -16,14 +16,16 @@ class EventParticipationCancelled implements ShouldBroadcastNow
public $userId;
public $event;
+ public $notificationId;
/**
* Create a new event instance.
*/
- public function __construct($userId, Event $event)
+ public function __construct($userId, Event $event, $notificationId)
{
$this->userId = $userId;
$this->event = $event;
+ $this->notificationId = $notificationId;
}
/**
diff --git a/app/Events/TaskDateUpdated.php b/app/Events/TaskDateUpdated.php
index 9526a5b..dcf7fa1 100644
--- a/app/Events/TaskDateUpdated.php
+++ b/app/Events/TaskDateUpdated.php
@@ -18,18 +18,20 @@ class TaskDateUpdated implements ShouldBroadcastNow
public $event;
public $start;
public $end;
+ public $notificationId;
protected $userId;
/**
* Create a new event instance.
*/
- public function __construct($userId, Task $task, Event $event, $start, $end)
+ public function __construct($userId, Task $task, Event $event, $start, $end, $notificationId)
{
$this->userId = $userId;
$this->task = $task;
$this->event = $event;
$this->start = $start;
$this->end = $end;
+ $this->notificationId = $notificationId;
}
/**
diff --git a/app/Events/TaskParticipationCancelled.php b/app/Events/TaskParticipationCancelled.php
index df6ee78..698a10e 100644
--- a/app/Events/TaskParticipationCancelled.php
+++ b/app/Events/TaskParticipationCancelled.php
@@ -17,15 +17,17 @@ class TaskParticipationCancelled implements ShouldBroadcastNow
public $userId;
public $task;
public $event;
+ public $notificationId;
/**
* Create a new event instance.
*/
- public function __construct($userId, Task $task, Event $event)
+ public function __construct($userId, Task $task, Event $event, $notificationId)
{
$this->userId = $userId;
$this->task = $task;
$this->event = $event;
+ $this->notificationId = $notificationId;
}
/**
diff --git a/app/Events/UserCreated.php b/app/Events/UserCreated.php
index ead5cf3..a27ee47 100644
--- a/app/Events/UserCreated.php
+++ b/app/Events/UserCreated.php
@@ -15,13 +15,15 @@ class UserCreated implements ShouldBroadcastNow
public $user;
+ public $notificationId;
/**
* Create a new event instance.
*/
- public function __construct(User $user)
+ public function __construct(User $user, $notificationId)
{
$this->user = $user;
+ $this->notificationId = $notificationId;
}
/**
diff --git a/app/Events/VolunteerAssignedToTask.php b/app/Events/VolunteerAssignedToTask.php
index 120f17c..0b96aaf 100644
--- a/app/Events/VolunteerAssignedToTask.php
+++ b/app/Events/VolunteerAssignedToTask.php
@@ -16,16 +16,18 @@ class VolunteerAssignedToTask implements ShouldBroadcastNow
public $task;
public $event;
+ public $notificationId;
protected $userId;
/**
* Create a new event instance.
*/
- public function __construct($userId, Task $task, Event $event)
+ public function __construct($userId, Task $task, Event $event, $notificationId)
{
$this->userId = $userId;
$this->task = $task;
$this->event = $event;
+ $this->notificationId = $notificationId;
}
/**
diff --git a/app/Events/VolunteerRoleUpdated.php b/app/Events/VolunteerRoleUpdated.php
index e73bd47..690d114 100644
--- a/app/Events/VolunteerRoleUpdated.php
+++ b/app/Events/VolunteerRoleUpdated.php
@@ -15,15 +15,17 @@ class VolunteerRoleUpdated implements ShouldBroadcastNow
use Dispatchable, InteractsWithSockets, SerializesModels;
public $role;
+ public $notificationId;
protected $userId;
/**
* Create a new event instance.
*/
- public function __construct($userId, $role)
+ public function __construct($userId, $role, $notificationId)
{
$this->userId = $userId;
$this->role = $role;
+ $this->notificationId = $notificationId;
}
/**
diff --git a/app/Events/VolunteerUnassignedFromTask.php b/app/Events/VolunteerUnassignedFromTask.php
index 70c1207..14f370b 100644
--- a/app/Events/VolunteerUnassignedFromTask.php
+++ b/app/Events/VolunteerUnassignedFromTask.php
@@ -17,15 +17,17 @@ class VolunteerUnassignedFromTask implements ShouldBroadcastNow
public $userId;
public $task;
public $event;
+ public $notificationId;
/**
* Create a new event instance.
*/
- public function __construct($userId, Task $task, Event $event)
+ public function __construct($userId, Task $task, Event $event, $notificationId)
{
$this->userId = $userId;
$this->task = $task;
$this->event = $event;
+ $this->notificationId = $notificationId;
}
/**
diff --git a/app/Http/Controllers/EventsController.php b/app/Http/Controllers/EventsController.php
index 117398e..080851e 100644
--- a/app/Http/Controllers/EventsController.php
+++ b/app/Http/Controllers/EventsController.php
@@ -107,7 +107,8 @@ class EventsController extends Controller
foreach ($participants as $user) {
broadcast(new EventParticipationCancelled(
$user->id,
- $event
+ $event,
+ $notification->id,
));
$data = [
diff --git a/app/Http/Controllers/TasksController.php b/app/Http/Controllers/TasksController.php
index e08bd52..412ef0d 100644
--- a/app/Http/Controllers/TasksController.php
+++ b/app/Http/Controllers/TasksController.php
@@ -107,6 +107,7 @@ class TasksController extends Controller
$user->id,
$task,
$event,
+ $notification->id,
));
$data = [
@@ -171,6 +172,7 @@ class TasksController extends Controller
$user->id,
$task,
$event,
+ $notification->id,
));
$data = [
@@ -224,6 +226,7 @@ class TasksController extends Controller
$event,
FormatDate::formatDate($request["start"]),
FormatDate::formatDate($request["end"]),
+ $notification->id,
));
$data = [
@@ -306,6 +309,7 @@ class TasksController extends Controller
$user->id,
$task,
$event,
+ $notification->id,
));
$data = [
diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php
index 58e6772..2622071 100644
--- a/app/Http/Controllers/UserController.php
+++ b/app/Http/Controllers/UserController.php
@@ -61,7 +61,10 @@ class UserController extends Controller
$notification->users()->attach(
$admins->pluck('id')->toArray()
);
- broadcast(new UserCreated($user));
+ broadcast(new UserCreated(
+ $user,
+ $notification->id,
+ ));
foreach ($admins as $admin) {
$data = [
@@ -263,7 +266,8 @@ class UserController extends Controller
broadcast(new VolunteerRoleUpdated(
$user->id,
- $role
+ $role,
+ $notification->id,
));
$data = [
From 2252ac9547866abad101a29056833ecef78f17b9 Mon Sep 17 00:00:00 2001
From: Giovanni-Josserand
Date: Thu, 19 Mar 2026 18:22:36 +0100
Subject: [PATCH 51/51] add $notificationId to every broadcast notification
---
app/Http/Controllers/EventsController.php | 2 +-
app/Http/Controllers/TasksController.php | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/app/Http/Controllers/EventsController.php b/app/Http/Controllers/EventsController.php
index 080851e..b41c2f9 100644
--- a/app/Http/Controllers/EventsController.php
+++ b/app/Http/Controllers/EventsController.php
@@ -100,7 +100,7 @@ class EventsController extends Controller
if (Carbon::now()->lessThanOrEqualTo($event->end)) {
$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'));
diff --git a/app/Http/Controllers/TasksController.php b/app/Http/Controllers/TasksController.php
index 412ef0d..a74bf04 100644
--- a/app/Http/Controllers/TasksController.php
+++ b/app/Http/Controllers/TasksController.php
@@ -32,7 +32,7 @@ class TasksController extends Controller
try {
- $event = Event::find($request["events_id"]);
+ $event = Event::find($request["event_id"]);
$event->tasks()->create([
"name" => $request["name"],
@@ -94,9 +94,9 @@ class TasksController extends Controller
}
$user = User::find($id);
+ $task->users()->attach($id);
if($user && Carbon::now()->lessThanOrEqualTo($task->end)) {
- $task->users()->attach($id);
$notification = Notification::create([
'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 ($participants->isNotEmpty()) {
$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'));
}
@@ -298,9 +298,9 @@ class TasksController extends Controller
}
$user = User::find($id);
+ $task->users()->detach($id);
if ($user && Carbon::now()->lessThanOrEqualTo($task->end)) {
- $task->users()->detach($id);
$notification = Notification::create([
'content' => "Vous avez été désassigné de la tâche {$task->name} de l'événement {$event->name}."
]);