Merge branch 'main' into 'dev'
create notification, broadcast notification and mail when a futur or ongoing... See merge request sae-but2/2025-26/gestion-benevoles-association/backend!30
This commit is contained in:
@@ -2,12 +2,10 @@
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use App\Models\Events;
|
||||
use App\Models\Event;
|
||||
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;
|
||||
@@ -18,14 +16,16 @@ class EventParticipationCancelled implements ShouldBroadcastNow
|
||||
|
||||
public $userId;
|
||||
public $event;
|
||||
public $notificationId;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*/
|
||||
public function __construct($userId, Events $event)
|
||||
public function __construct($userId, Event $event, $notificationId)
|
||||
{
|
||||
$this->userId = $userId;
|
||||
$this->event = $event;
|
||||
$this->notificationId = $notificationId;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use App\Models\Event;
|
||||
use App\Models\Task;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Broadcasting\PrivateChannel;
|
||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class TaskDateUpdated implements ShouldBroadcastNow
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
public $task;
|
||||
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, $notificationId)
|
||||
{
|
||||
$this->userId = $userId;
|
||||
$this->task = $task;
|
||||
$this->event = $event;
|
||||
$this->start = $start;
|
||||
$this->end = $end;
|
||||
$this->notificationId = $notificationId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the channels the event should broadcast on.
|
||||
*
|
||||
* @return array<int, \Illuminate\Broadcasting\Channel>
|
||||
*/
|
||||
public function broadcastOn(): array
|
||||
{
|
||||
return [
|
||||
new PrivateChannel('user.' . $this->userId),
|
||||
];
|
||||
}
|
||||
|
||||
public function broadcastAs()
|
||||
{
|
||||
return 'task.date.updated';
|
||||
}
|
||||
}
|
||||
@@ -2,13 +2,10 @@
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use App\Models\Events;
|
||||
use App\Models\Event;
|
||||
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;
|
||||
@@ -20,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, Events $event)
|
||||
public function __construct($userId, Task $task, Event $event, $notificationId)
|
||||
{
|
||||
$this->userId = $userId;
|
||||
$this->task = $task;
|
||||
$this->event = $event;
|
||||
$this->notificationId = $notificationId;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -32,7 +34,7 @@ class UserCreated implements ShouldBroadcastNow
|
||||
public function broadcastOn(): array
|
||||
{
|
||||
return [
|
||||
new privateChannel('users.registration'),
|
||||
new privateChannel('users.admin'),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -2,13 +2,10 @@
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use App\Models\Events;
|
||||
use App\Models\Event;
|
||||
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;
|
||||
@@ -19,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, Events $event)
|
||||
public function __construct($userId, Task $task, Event $event, $notificationId)
|
||||
{
|
||||
$this->userId = $userId;
|
||||
$this->task = $task;
|
||||
$this->event = $event;
|
||||
$this->notificationId = $notificationId;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use App\Models\Event;
|
||||
use App\Models\Task;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Broadcasting\PrivateChannel;
|
||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class VolunteerRoleUpdated implements ShouldBroadcastNow
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
public $role;
|
||||
public $notificationId;
|
||||
protected $userId;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*/
|
||||
public function __construct($userId, $role, $notificationId)
|
||||
{
|
||||
$this->userId = $userId;
|
||||
$this->role = $role;
|
||||
$this->notificationId = $notificationId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the channels the event should broadcast on.
|
||||
*
|
||||
* @return array<int, \Illuminate\Broadcasting\Channel>
|
||||
*/
|
||||
public function broadcastOn(): array
|
||||
{
|
||||
return [
|
||||
new PrivateChannel('user.' . $this->userId),
|
||||
];
|
||||
}
|
||||
|
||||
public function broadcastAs()
|
||||
{
|
||||
return 'volunteer.role.updated';
|
||||
}
|
||||
}
|
||||
@@ -2,13 +2,10 @@
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use App\Models\Events;
|
||||
use App\Models\Event;
|
||||
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;
|
||||
@@ -20,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, Events $event)
|
||||
public function __construct($userId, Task $task, Event $event, $notificationId)
|
||||
{
|
||||
$this->userId = $userId;
|
||||
$this->task = $task;
|
||||
$this->event = $event;
|
||||
$this->notificationId = $notificationId;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,12 +3,16 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Events\EventParticipationCancelled;
|
||||
use App\Models\Events;
|
||||
use App\Models\Event;
|
||||
use App\Models\Notification;
|
||||
use App\Mail\EventParticipationCancelledMail;
|
||||
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;
|
||||
use Carbon\Carbon;
|
||||
|
||||
|
||||
class EventsController extends Controller
|
||||
@@ -17,13 +21,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'],
|
||||
@@ -41,13 +45,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'];
|
||||
@@ -64,10 +68,8 @@ class EventsController extends Controller
|
||||
}
|
||||
|
||||
public function getEvents(Request $request): JsonResponse {
|
||||
|
||||
try {
|
||||
|
||||
$events = Events::with('tasks')->get();
|
||||
$events = Event::with('tasks')->get();
|
||||
|
||||
return response()->json(['data' => $events]);
|
||||
|
||||
@@ -80,12 +82,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);
|
||||
@@ -95,17 +97,33 @@ class EventsController extends Controller
|
||||
return $task->users;
|
||||
})->unique('id');
|
||||
|
||||
|
||||
if (Carbon::now()->lessThanOrEqualTo($event->end)) {
|
||||
$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,
|
||||
$event
|
||||
$event,
|
||||
$notification->id,
|
||||
));
|
||||
|
||||
$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();
|
||||
|
||||
return response()->json(["message" => "Event deleted and participants notified"]);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
Log::error("Event delete error: " . $e->getMessage());
|
||||
return response()->json(['message' => "Server error"], 500);
|
||||
@@ -113,10 +131,9 @@ class EventsController extends Controller
|
||||
}
|
||||
|
||||
public function getEvent(Request $request, int $id): JsonResponse {
|
||||
|
||||
try {
|
||||
|
||||
$event = Events::find($id);
|
||||
$event = Event::find($id);
|
||||
return response()->json([
|
||||
"id" => $event->id,
|
||||
"name" => $event->name,
|
||||
|
||||
@@ -2,16 +2,25 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Events\TaskDateUpdated;
|
||||
use App\Events\TaskParticipationCancelled;
|
||||
use App\Events\VolunteerAssignedToTask;
|
||||
use App\Events\VolunteerUnassignedFromTask;
|
||||
use App\Models\Events;
|
||||
use App\Mail\TaskDateUpdateMail;
|
||||
use App\Models\Event;
|
||||
use App\Models\Notification;
|
||||
use App\Mail\VolunteerAssignToTaskMail;
|
||||
use App\Mail\VolunteerUnassignToTaskMail;
|
||||
use App\Models\Task;
|
||||
use App\Models\User;
|
||||
use Carbon\Carbon;
|
||||
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;
|
||||
use App\Services\FormatDate;
|
||||
|
||||
class TasksController extends Controller
|
||||
{
|
||||
@@ -23,7 +32,7 @@ class TasksController extends Controller
|
||||
|
||||
try {
|
||||
|
||||
$event = Events::find($request["event_id"]);
|
||||
$event = Event::find($request["event_id"]);
|
||||
|
||||
$event->tasks()->create([
|
||||
"name" => $request["name"],
|
||||
@@ -73,8 +82,8 @@ class TasksController extends Controller
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
$task = Task::with('event')->find($request["task_id"]);
|
||||
$task = Task::find($request["task_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);
|
||||
@@ -85,14 +94,31 @@ class TasksController extends Controller
|
||||
}
|
||||
|
||||
$user = User::find($id);
|
||||
|
||||
if($user) {
|
||||
$task->users()->attach($id);
|
||||
|
||||
if($user && Carbon::now()->lessThanOrEqualTo($task->end)) {
|
||||
|
||||
$notification = Notification::create([
|
||||
'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,
|
||||
$task->event
|
||||
$event,
|
||||
$notification->id,
|
||||
));
|
||||
|
||||
$data = [
|
||||
'name' => $user->name,
|
||||
'lastname' => $user->lastname,
|
||||
'taskName' => $task->name,
|
||||
'start' => $task->start,
|
||||
'end' => $task->end,
|
||||
'eventName' => $event->name,
|
||||
];
|
||||
Mail::to($user->email)->send(new VolunteerAssignToTaskMail($data));
|
||||
}
|
||||
|
||||
return response()->json(['message' => "Task assigned"], 200);
|
||||
@@ -107,7 +133,7 @@ class TasksController extends Controller
|
||||
|
||||
try {
|
||||
|
||||
$event = Events::find($id);
|
||||
$event = Event::find($id);
|
||||
|
||||
return response()->json(['data' => $event->tasks()->get()]);
|
||||
|
||||
@@ -124,7 +150,8 @@ class TasksController extends Controller
|
||||
}
|
||||
|
||||
try {
|
||||
$task = Task::with(['users', 'event'])->find($id);
|
||||
$task = Task::with(['users'])->find($id);
|
||||
$event = Event::find($task->events_id);
|
||||
|
||||
if (!$task) {
|
||||
return response()->json(["message" => "Task not found"], 404);
|
||||
@@ -132,12 +159,32 @@ class TasksController extends Controller
|
||||
|
||||
$participants = $task->users;
|
||||
|
||||
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."
|
||||
]);
|
||||
$notification->users()->attach($participants->pluck('id'));
|
||||
}
|
||||
|
||||
foreach ($participants as $user) {
|
||||
broadcast(new TaskParticipationCancelled(
|
||||
$user->id,
|
||||
$task,
|
||||
$task->event
|
||||
$event,
|
||||
$notification->id,
|
||||
));
|
||||
|
||||
$data = [
|
||||
'name' => $user->name,
|
||||
'lastname' => $user->lastname,
|
||||
'taskName' => $task->name,
|
||||
'start' => $event->start,
|
||||
'end' => $task->end,
|
||||
'eventName' => $event->name,
|
||||
];
|
||||
Mail::to($user->email)->send(new TaskParticipationCancelledMail($data));
|
||||
}
|
||||
}
|
||||
|
||||
$task->delete();
|
||||
@@ -157,8 +204,45 @@ 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->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,
|
||||
FormatDate::formatDate($request["start"]),
|
||||
FormatDate::formatDate($request["end"]),
|
||||
$notification->id,
|
||||
));
|
||||
|
||||
$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"];
|
||||
@@ -175,10 +259,6 @@ class TasksController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function unassignSelf(Request $request): JsonResponse {
|
||||
try {
|
||||
$task = Task::find($request["task_id"]);
|
||||
@@ -198,8 +278,6 @@ class TasksController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function unassignUser(Request $request, int $id): JsonResponse {
|
||||
|
||||
if(Gate::denies('unassignOther', Task::class)) {
|
||||
@@ -207,7 +285,8 @@ class TasksController extends Controller
|
||||
}
|
||||
|
||||
try {
|
||||
$task = Task::with('event')->find($request["task_id"]);
|
||||
$task = Task::find($request["task_id"]);
|
||||
$event = Event::find($task->events_id);
|
||||
|
||||
if (!$task) {
|
||||
return response()->json(["message" => "Task not found"], 404);
|
||||
@@ -219,15 +298,29 @@ class TasksController extends Controller
|
||||
}
|
||||
|
||||
$user = User::find($id);
|
||||
|
||||
if ($user) {
|
||||
$task->users()->detach($id);
|
||||
|
||||
if ($user && Carbon::now()->lessThanOrEqualTo($task->end)) {
|
||||
$notification = Notification::create([
|
||||
'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,
|
||||
$task->event
|
||||
$event,
|
||||
$notification->id,
|
||||
));
|
||||
|
||||
$data = [
|
||||
'name' => $user->name,
|
||||
'lastname' => $user->lastname,
|
||||
'taskName' => $task->name,
|
||||
'start' => $task->start,
|
||||
'end' => $task->end,
|
||||
'eventName' => $event->name,
|
||||
];
|
||||
Mail::to($user->email)->send(new VolunteerUnassignToTaskMail($data));
|
||||
}
|
||||
|
||||
return response()->json(['message' => "User unassigned successfully"], 200);
|
||||
|
||||
@@ -3,8 +3,16 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Events\UserCreated;
|
||||
use App\Events\VolunteerRoleUpdated;
|
||||
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;
|
||||
use App\Models\User;
|
||||
use App\Services\GetRole;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -12,6 +20,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;
|
||||
|
||||
@@ -46,14 +55,26 @@ class UserController extends Controller
|
||||
|
||||
|
||||
$notification = Notification::create([
|
||||
'content' => "Nouvelle demande d'inscription : {$user->name} {$user->lastname}",
|
||||
'content' => "Nouvelle demande d'inscription : {$user->name} {$user->lastname}"
|
||||
]);
|
||||
$admins = User::whereIn('role', [1, 2])->get();
|
||||
$notification->users()->attach(
|
||||
$admins->pluck('id')->toArray()
|
||||
);
|
||||
broadcast(new UserCreated(
|
||||
$user,
|
||||
$notification->id,
|
||||
));
|
||||
|
||||
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']);
|
||||
}
|
||||
@@ -83,6 +104,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,
|
||||
@@ -92,6 +120,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) {
|
||||
@@ -122,6 +157,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) {
|
||||
@@ -140,6 +181,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);
|
||||
@@ -179,20 +226,18 @@ 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;
|
||||
$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) {
|
||||
@@ -212,12 +257,27 @@ 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);
|
||||
|
||||
broadcast(new VolunteerRoleUpdated(
|
||||
$user->id,
|
||||
$role,
|
||||
$notification->id,
|
||||
));
|
||||
|
||||
$data = [
|
||||
'name' => $user->name,
|
||||
'lastname' => $user->lastname,
|
||||
'role' => $role,
|
||||
];
|
||||
Mail::to($user->email)->send(new UpdateRoleMail($data));
|
||||
|
||||
|
||||
return response()->json(['message' => 'User role added successfully']);
|
||||
} catch(\Exception $e) {
|
||||
Log::info($e->getMessage());
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class CreateUserByAdminMail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
public $data;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct($data)
|
||||
{
|
||||
$this->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<int, \Illuminate\Mail\Mailables\Attachment>
|
||||
*/
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class DeactivateAccountMail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
public $data;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct($data)
|
||||
{
|
||||
$this->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<int, \Illuminate\Mail\Mailables\Attachment>
|
||||
*/
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class DeleteAccountMail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
public $data;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct($data)
|
||||
{
|
||||
$this->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<int, \Illuminate\Mail\Mailables\Attachment>
|
||||
*/
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use App\Services\FormatDate;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class EventParticipationCancelledMail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
public $data;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct($data)
|
||||
{
|
||||
$this->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'],
|
||||
'start' => FormatDate::formatDate($this->data['start']),
|
||||
'end' => FormatDate::formatDate($this->data['end']),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the attachments for the message.
|
||||
*
|
||||
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
|
||||
*/
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class RegisterMail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
public $data;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct($data)
|
||||
{
|
||||
$this->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<int, \Illuminate\Mail\Mailables\Attachment>
|
||||
*/
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class TaskDateUpdateMail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
public $data;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct($data)
|
||||
{
|
||||
$this->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<int, \Illuminate\Mail\Mailables\Attachment>
|
||||
*/
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use App\Services\FormatDate;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class TaskParticipationCancelledMail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
public $data;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct($data)
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message envelope.
|
||||
*/
|
||||
public function envelope(): Envelope
|
||||
{
|
||||
return new Envelope(
|
||||
subject: 'Tâche supprimée - 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'],
|
||||
'end' => FormatDate::formatDate($this->data['end']),
|
||||
'start' => FormatDate::formatDate($this->data['start']),
|
||||
'eventName' => $this->data['eventName'],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the attachments for the message.
|
||||
*
|
||||
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
|
||||
*/
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class UpdateRoleMail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
public $data;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct($data)
|
||||
{
|
||||
$this->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<int, \Illuminate\Mail\Mailables\Attachment>
|
||||
*/
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class ValidateMail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
public $data;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct($data)
|
||||
{
|
||||
$this->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<int, \Illuminate\Mail\Mailables\Attachment>
|
||||
*/
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use App\Services\FormatDate;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class VolunteerAssignToTaskMail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
public $data;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct($data)
|
||||
{
|
||||
$this->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' => FormatDate::formatDate($this->data['start']),
|
||||
'end' => FormatDate::formatDate($this->data['end']),
|
||||
'eventName' => $this->data['eventName'],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the attachments for the message.
|
||||
*
|
||||
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
|
||||
*/
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
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
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
public $data;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct($data)
|
||||
{
|
||||
$this->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' => FormatDate::formatDate($this->data['start']),
|
||||
'end' => FormatDate::formatDate($this->data['end']),
|
||||
'eventName' => $this->data['eventName'],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the attachments for the message.
|
||||
*
|
||||
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
|
||||
*/
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -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 = [
|
||||
@@ -16,6 +16,6 @@ class Events extends Model
|
||||
];
|
||||
|
||||
public function tasks() {
|
||||
return $this->hasMany(Task::class);
|
||||
return $this->hasMany(Task::class, 'events_id');
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ class Notification extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'content',
|
||||
'user_id',
|
||||
];
|
||||
|
||||
public function users(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
@@ -16,7 +17,6 @@ class Notification extends Model
|
||||
User::class,
|
||||
'notification_user',
|
||||
'notification_id',
|
||||
'user_id'
|
||||
)
|
||||
->withPivot('unread')
|
||||
->withTimestamps();
|
||||
|
||||
+1
-4
@@ -2,13 +2,10 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\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() {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\Models\Events;
|
||||
use App\Models\Event;
|
||||
use App\Models\User;
|
||||
use Illuminate\Auth\Access\Response;
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use Carbon\Carbon;
|
||||
|
||||
class FormatDate
|
||||
{
|
||||
public static function formatDate($date){
|
||||
return Carbon::parse($date)->format('d/m/Y, H:i');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,6 +6,7 @@ class GetRole
|
||||
{
|
||||
public static function getRole($role)
|
||||
{
|
||||
$role = (int)$role;
|
||||
return match ($role) {
|
||||
1 => "Président",
|
||||
2 => "Gérant",
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Services;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class UserService
|
||||
{
|
||||
|
||||
+5
-2
@@ -15,11 +15,14 @@ return [
|
||||
|
|
||||
*/
|
||||
|
||||
'paths' => ['api/*', 'sanctum/csrf-cookie', 'broadcasting/auth'],
|
||||
|
||||
'paths' => explode(',', env('CORS_PATHS', 'api/*')),
|
||||
|
||||
'allowed_methods' => ['*'],
|
||||
|
||||
'allowed_origins' => ['*'],
|
||||
'allowed_origins' => env('DEV', 0) == 1
|
||||
? explode(',', env('DEV_CORS_ALLOWED_ORIGINS'))
|
||||
: explode(',', env('PROD_CORS_ALLOWED_ORIGINS')),
|
||||
|
||||
'allowed_origins_patterns' => [],
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Compte créé</title>
|
||||
</head>
|
||||
<body style="padding: 20px; font-family: Arial, sans-serif;">
|
||||
<div>
|
||||
<p>Bonjour {{ $name }} {{ $lastname }},</p>
|
||||
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Vous pouvez dès à présent vous connecter et accéder à votre espace personnel afin de participer
|
||||
aux activités proposées.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Veuillez vous renseigner auprès d'un administrateur pour récupérer vos identifiants.
|
||||
</p>
|
||||
|
||||
<p style="text-align: center; margin: 30px 0;">
|
||||
<a href="{{ url('/') }}"
|
||||
style="background-color: #3498db; color: white; padding: 12px 20px; text-decoration: none; border-radius: 5px;">
|
||||
Se connecter
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
À très bientôt,<br>
|
||||
L’équipe du Comité des fêtes de Beaupont
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<p style="font-size: 14px; color: #999; text-align: center; padding-top: 20px;">
|
||||
Cet email a été envoyé automatiquement, merci de ne pas y répondre.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,40 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Compte désactivé</title>
|
||||
</head>
|
||||
<body style="padding: 20px; font-family: Arial, sans-serif;">
|
||||
<div>
|
||||
<p>Bonjour {{ $name }} {{ $lastname }},</p>
|
||||
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Vous ne pouvez désormais plus accéder à votre espace personnel ni participer aux activités proposées.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Votre compte pourra être réactivé ultérieurement si nécessaire.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
À bientôt,<br>
|
||||
L’équipe du Comité des fêtes de Beaupont
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<p style="font-size: 14px; color: #999; text-align: center; padding-top: 20px;">
|
||||
Cet email a été envoyé automatiquement, merci de ne pas y répondre.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,39 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Compte supprimé</title>
|
||||
</head>
|
||||
<body style="padding: 20px; font-family: Arial, sans-serif;">
|
||||
<div>
|
||||
<p>Bonjour {{ $name }} {{ $lastname }},</p>
|
||||
|
||||
<p>
|
||||
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é.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Vous n’avez désormais plus accès à votre espace personnel ni aux services associés.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Si vous n’êtes pas à l’origine de cette action, merci de nous contacter rapidement.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Si vous souhaitez à nouveau participer aux activités, vous pouvez effectuer une nouvelle inscription à tout moment.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
À bientôt,<br>
|
||||
L’équipe du Comité des fêtes de Beaupont
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<p style="font-size: 14px; color: #999; text-align: center; padding-top: 20px;">
|
||||
Cet email a été envoyé automatiquement, merci de ne pas y répondre.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,32 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Événement supprimé</title>
|
||||
</head>
|
||||
<body style="padding: 20px; font-family: Arial, sans-serif;">
|
||||
<div>
|
||||
<p>Bonjour {{ $name }} {{ $lastname }},</p>
|
||||
|
||||
<p>
|
||||
L’événement {{ $eventName }} a été supprimé par un administrateur.
|
||||
Vous n’y participez donc plus. Cet événement avait lieu du {{ $start }} au {{ $end }}.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
À très bientôt,<br>
|
||||
L’équipe du Comité des fêtes de Beaupont
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<p style="font-size: 14px; color: #999; text-align: center; padding-top: 20px;">
|
||||
Cet email a été envoyé automatiquement, merci de ne pas y répondre.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,38 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Nouvelle demande de validation</title>
|
||||
</head>
|
||||
<body style="padding: 20px; font-family: Arial, sans-serif;">
|
||||
<div>
|
||||
<p>Bonjour {{ $adminName }} {{ $adminLastname }},</p>
|
||||
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
|
||||
<p style="text-align: center; margin: 30px 0;">
|
||||
<a href="{{ url('/admin') }}"
|
||||
style="background-color: #f39c12; color: white; padding: 12px 20px; text-decoration: none; border-radius: 5px;">
|
||||
Valider ce compte
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Vous pouvez cliquer sur le bouton ci-dessus pour vous rendre sur la page permettant de valider le compte.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
À très bientôt,<br>
|
||||
L’équipe du Comité des fêtes de Beaupont
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<p style="font-size: 14px; color: #999; text-align: center; padding-top: 20px;">
|
||||
Cet email a été envoyé automatiquement, merci de ne pas y répondre.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,32 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Date de tâche modifiée</title>
|
||||
</head>
|
||||
<body style="padding: 20px; font-family: Arial, sans-serif;">
|
||||
<div>
|
||||
<p>Bonjour {{ $name }} {{ $lastname }},</p>
|
||||
|
||||
<p>
|
||||
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 }}.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
À très bientôt,<br>
|
||||
L’équipe du Comité des fêtes de Beaupont
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<p style="font-size: 14px; color: #999; text-align: center; padding-top: 20px;">
|
||||
Cet email a été envoyé automatiquement, merci de ne pas y répondre.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,32 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Tâche supprimée</title>
|
||||
</head>
|
||||
<body style="padding: 20px; font-family: Arial, sans-serif;">
|
||||
<div>
|
||||
<p>Bonjour {{ $name }} {{ $lastname }},</p>
|
||||
|
||||
<p>
|
||||
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 }}.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
À très bientôt,<br>
|
||||
L’équipe du Comité des fêtes de Beaupont
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<p style="font-size: 14px; color: #999; text-align: center; padding-top: 20px;">
|
||||
Cet email a été envoyé automatiquement, merci de ne pas y répondre.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,35 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Rôle mis à jour</title>
|
||||
</head>
|
||||
<body style="padding: 20px; font-family: Arial, sans-serif;">
|
||||
<div>
|
||||
<p>Bonjour {{ $name }} {{ $lastname }},</p>
|
||||
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Vous êtes désormais : {{ $role }}
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Si vous avez des questions concernant ce changement, n’hésitez pas à contacter l’équipe organisatrice.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
À très bientôt,<br>
|
||||
L’équipe du Comité des fêtes de Beaupont
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<p style="font-size: 14px; color: #999; text-align: center; padding-top: 20px;">
|
||||
Cet email a été envoyé automatiquement, merci de ne pas y répondre.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,47 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Compte validé</title>
|
||||
</head>
|
||||
|
||||
<body style="padding:20px; font-family: Arial, sans-serif;">
|
||||
|
||||
<div style="width:100%; text-align:center;">
|
||||
<h1 style="color:#2c3e50;">🎉 Compte validé !</h1>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<p>Bonjour {{ $name }} {{ $lastname }},</p>
|
||||
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Vous pouvez dès à présent accéder à votre espace personnel et participer aux différentes activités proposées.
|
||||
</p>
|
||||
|
||||
<div style="text-align:center; margin:30px 0;">
|
||||
<a href="{{ url('/') }}"
|
||||
style="background-color:#3498db; color:white; padding:12px 20px; text-decoration:none; border-radius:5px;">
|
||||
Accéder à mon compte
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
Si vous avez la moindre question ou besoin d’assistance, n’hésitez pas à nous contacter.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
À très bientôt,<br>
|
||||
L’équipe du Comité des fêtes de Beaupont
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<p style="font-size:14px; color:#999; text-align:center; padding-top:20px;">
|
||||
Cet email a été envoyé automatiquement, merci de ne pas y répondre.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,32 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Assignation</title>
|
||||
</head>
|
||||
<body style="padding: 20px; font-family: Arial, sans-serif;">
|
||||
<div>
|
||||
<p>Bonjour {{ $name }} {{ $lastname }},</p>
|
||||
|
||||
<p>
|
||||
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 }}.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
À très bientôt,<br>
|
||||
L’équipe du Comité des fêtes de Beaupont
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<p style="font-size: 14px; color: #999; text-align: center; padding-top: 20px;">
|
||||
Cet email a été envoyé automatiquement, merci de ne pas y répondre.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,32 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Désassignation</title>
|
||||
</head>
|
||||
<body style="padding: 20px; font-family: Arial, sans-serif;">
|
||||
<div>
|
||||
<p>Bonjour {{ $name }} {{ $lastname }},</p>
|
||||
|
||||
<p>
|
||||
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 }}.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
À très bientôt,<br>
|
||||
L’équipe du Comité des fêtes de Beaupont
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<p style="font-size: 14px; color: #999; text-align: center; padding-top: 20px;">
|
||||
Cet email a été envoyé automatiquement, merci de ne pas y répondre.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
+1
-1
@@ -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]);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
headers {
|
||||
Accept: application/json
|
||||
X-XSRF-TOKEN:
|
||||
X-XSRF-TOKEN: eyJpdiI6ImVGRmdjSGtkUUtUT2E3TVE0RVM3c0E9PSIsInZhbHVlIjoiTkNldWpJb0I3T1dQMVJmTm43ekRPa2ZocFRZc25jYVlyZ0RBVDV3UjJVVDdpQkI1MUtkNWZROS9xbHdPUElHNTlrcjh2TUIxaTNtL20wYXZpdnltRGhNTGpsSGZETFV3VUtNd200OWcwUXFiYU9Eamd1VmFxRzVBNVNZVHBxMEEiLCJtYWMiOiJiMTM1OGVhOGRjM2VjMTg5ZDk4MzMwMjBmNjBkZjQ4OGIzODcwZjMzYzZkOTQxY2E5YjYyMDUxNGY5MzFjNjA1IiwidGFnIjoiIn0=
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user