From 7d02ed4ca76acf61b0f607d095755e7e527ea6c9 Mon Sep 17 00:00:00 2001 From: Alexandr Chernyaev Date: Mon, 16 Dec 2024 13:38:04 +0300 Subject: [PATCH] Changed: Closed santa register --- app/Http/Controllers/SantaController.php | 15 +++++++++++---- resources/views/santa/index.blade.php | 14 +++++++++++++- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/SantaController.php b/app/Http/Controllers/SantaController.php index 6f473898..06ffabb2 100644 --- a/app/Http/Controllers/SantaController.php +++ b/app/Http/Controllers/SantaController.php @@ -63,11 +63,18 @@ public function update(Request $request): RedirectResponse ->secretSantaParticipant() ->firstOrNew(); + if (!$participant->exists) { + Toast::warning('К сожалению, регистрация на Тайного Санту уже закрыта.') + ->disableAutoHide(); + + return redirect()->route('santa'); + } + $data = $request->validate([ - 'telegram' => ['string', 'required_without:tracking_number'], - 'phone' => ['string', 'required_without:tracking_number'], - 'address' => ['string', 'required_without:tracking_number'], - 'about' => ['string', 'required_without:tracking_number'], + //'telegram' => ['string', 'required_without:tracking_number'], + //'phone' => ['string', 'required_without:tracking_number'], + //'address' => ['string', 'required_without:tracking_number'], + //'about' => ['string', 'required_without:tracking_number'], 'tracking_number' => [ 'nullable', 'string', diff --git a/resources/views/santa/index.blade.php b/resources/views/santa/index.blade.php index a6d3da75..9feb08f6 100644 --- a/resources/views/santa/index.blade.php +++ b/resources/views/santa/index.blade.php @@ -16,7 +16,19 @@ - {{ $participant->exists ? 'Посмотреть статус' : 'Присоединиться' }} + + @if($participant->exists) + + Посмотреть статус + + @else + + Санта уже укомплектован 🎅 + {{-- Присоединиться --}} + + @endif + + Полные правила