public function getRegistration($slug) { $tournament = Tournament::where('slug', $slug)->firstOrFail(); $adultParticipantType = ParticipantType::findOrFail(ParticipantType::ADULT); $familyParticipantType = ParticipantType::findOrFail(ParticipantType::FAMILY); // determine if the head coach is registering this spectator if (Session::group() == null) { $view = 'tournaments.registration.standalone-spectator'; } else { $view = 'tournaments.registration.headcoach-spectator'; } return view($view, ['tournament' => $tournament, 'adultFee' => $tournament->fee($adultParticipantType), 'familyFee' => $tournament->fee($familyParticipantType)]); }
/** * Standalone registration is a Quizmaster that is registering * themselves, not the Head Coach registering on their behalf. */ public function postStandaloneRegistration(StandaloneQuizmasterRegistrationRequest $request, $slug, QuizmasterRegistrationPaymentReceived $quizmasterRegistrationPaymentReceived, QuizmasterRegistrar $quizmasterRegistrar) { $tournament = Tournament::where('slug', $slug)->firstOrFail(); $participantType = ParticipantType::findOrFail(ParticipantType::QUIZMASTER); $tournamentQuizmaster = $quizmasterRegistrar->register($tournament, $request->except('_token'), Auth::user(), $request->get('group_id') ? Group::findOrFail($request->get('group_id')) : null); $quizmasterRegistrationPaymentReceived->setTournamentQuizmaster($tournamentQuizmaster); // registrations with fees go to the cart $fee = $tournament->fee($participantType); if ($fee > 0) { $cart = Cart::clear(); $cart->setPostPurchaseEvent($quizmasterRegistrationPaymentReceived)->save(); $cart->add(TournamentQuizmaster::REGISTRATION_SKU, $fee, 1); return redirect('/cart'); } return $quizmasterRegistrationPaymentReceived->successStep(); }