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

+ +