diff --git a/app/Http/Controllers/SantaController.php b/app/Http/Controllers/SantaController.php index 6558371a..8d3f0b8b 100644 --- a/app/Http/Controllers/SantaController.php +++ b/app/Http/Controllers/SantaController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers; +use App\Models\SecretSantaParticipant; use App\Notifications\SimpleMessageNotification; use Illuminate\Contracts\View\View; use Illuminate\Http\RedirectResponse; @@ -18,10 +19,12 @@ class SantaController extends Controller */ public function index(Request $request): View { - $participant = $request->user() - ->secretSantaParticipant() + $participant = $request?->user() + ?->secretSantaParticipant() ->firstOrNew(); + $participant ??= new SecretSantaParticipant(); + return view('santa.index', [ 'participant' => $participant, ]); diff --git a/resources/views/santa/index.blade.php b/resources/views/santa/index.blade.php index d165f672..3bb7baf8 100644 --- a/resources/views/santa/index.blade.php +++ b/resources/views/santa/index.blade.php @@ -6,7 +6,7 @@
-