add information in notifications
This commit is contained in:
@@ -99,14 +99,14 @@ class TasksController extends Controller
|
|||||||
$task->users()->attach($id);
|
$task->users()->attach($id);
|
||||||
|
|
||||||
$notification = Notification::create([
|
$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);
|
$notification->users()->attach($user->id);
|
||||||
|
|
||||||
broadcast(new VolunteerAssignedToTask(
|
broadcast(new VolunteerAssignedToTask(
|
||||||
$user->id,
|
$user->id,
|
||||||
$task,
|
$task,
|
||||||
$event
|
$event,
|
||||||
));
|
));
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
@@ -161,7 +161,7 @@ class TasksController extends Controller
|
|||||||
if (Carbon::now()->lessThanOrEqualTo($task->end)) {
|
if (Carbon::now()->lessThanOrEqualTo($task->end)) {
|
||||||
if ($participants->isNotEmpty()) {
|
if ($participants->isNotEmpty()) {
|
||||||
$notification = Notification::create([
|
$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'));
|
$notification->users()->attach($participants->pluck('id'));
|
||||||
}
|
}
|
||||||
@@ -170,7 +170,7 @@ class TasksController extends Controller
|
|||||||
broadcast(new TaskParticipationCancelled(
|
broadcast(new TaskParticipationCancelled(
|
||||||
$user->id,
|
$user->id,
|
||||||
$task,
|
$task,
|
||||||
$event
|
$event,
|
||||||
));
|
));
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
@@ -299,13 +299,13 @@ class TasksController extends Controller
|
|||||||
if ($user && Carbon::now()->lessThanOrEqualTo($task->end)) {
|
if ($user && Carbon::now()->lessThanOrEqualTo($task->end)) {
|
||||||
$task->users()->detach($id);
|
$task->users()->detach($id);
|
||||||
$notification = Notification::create([
|
$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);
|
$notification->users()->attach($user->id);
|
||||||
broadcast(new VolunteerUnassignedFromTask(
|
broadcast(new VolunteerUnassignedFromTask(
|
||||||
$user->id,
|
$user->id,
|
||||||
$task,
|
$task,
|
||||||
$event
|
$event,
|
||||||
));
|
));
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ use App\Mail\UpdateRoleMail;
|
|||||||
use App\Mail\ValidateMail;
|
use App\Mail\ValidateMail;
|
||||||
use App\Models\Notification;
|
use App\Models\Notification;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use App\Services\GetRole;
|
||||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
@@ -253,10 +254,10 @@ class UserController extends Controller
|
|||||||
$user->role = $request['role'];
|
$user->role = $request['role'];
|
||||||
$user->save();
|
$user->save();
|
||||||
|
|
||||||
$role = \App\Services\GetRole::getRole($request['role']);
|
$role = GetRole::getRole($request['role']);
|
||||||
|
|
||||||
$notification = Notification::create([
|
$notification = Notification::create([
|
||||||
'content' => "Votre rôle à changé pour : {$role} !",
|
'content' => "Votre rôle à changé pour : {$role}",
|
||||||
]);
|
]);
|
||||||
$notification->users()->attach($user->id);
|
$notification->users()->attach($user->id);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user