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. +

+ +