/**
  * Regular registrations are where the Head Coach registers on
  * behalf of the Adult/Family.
  */
 public function postRegistration(SpectatorRegistrationRequest $request, $slug, SpectatorRegistrar $spectatorRegistrar)
 {
     $tournament = Tournament::where('slug', $slug)->firstOrFail();
     $spectator = $spectatorRegistrar->register($tournament, $request->except('_token'), $request->get('registering_as_current_user') == 1 ? Auth::user() : null, Session::group());
     $registrationType = 'Adult';
     if ($spectator->isFamily()) {
         $registrationType = 'Family';
     }
     return redirect('/tournaments/' . $tournament->slug . '/group')->withFlashSuccess($registrationType . ' has been added');
 }
 public function setTeamSet($slug, TeamSet $teamSet)
 {
     $tournament = Tournament::where('slug', $slug)->firstOrFail();
     /** @var GroupRegistration $registration */
     $registration = Session::tournamentGroupRegistration();
     $registration->setTournament($tournament);
     $registration->setTeamSet($teamSet);
     Session::setTournamentGroupRegistration($registration);
     return redirect('tournaments/group/quizmasters');
 }
 /**
  * @test
  */
 public function canEditTournament()
 {
     $tournament = Tournament::findOrFail(1);
     $newName = $tournament->name . time();
     $this->visit('/admin/tournaments/1/edit')->type($newName, 'name')->type(33.1, 'participantTypes[' . ParticipantType::PLAYER . '][earlybird_fee]')->type(25.1, 'participantTypes[' . ParticipantType::PLAYER . '][fee]')->type(45.1, 'participantTypes[' . ParticipantType::PLAYER . '][onsite_fee]')->press('Save')->see($tournament->name);
     $tournament = Tournament::where('id', 1)->firstOrFail();
     $playerFees = $tournament->participantFees()->where('participant_type_id', ParticipantType::PLAYER)->first();
     $this->assertEquals('33.10', $playerFees->earlybird_fee);
     $this->assertEquals('25.10', $playerFees->fee);
     $this->assertEquals('45.10', $playerFees->onsite_fee);
 }
 public function show($slug)
 {
     return view('tournaments.show', ['tournament' => $tournament = Tournament::where('slug', $slug)->firstOrFail(), 'events' => $tournament->events()->with('type')->get()]);
 }
 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     return Tournament::where('id', $this->route('tournament'))->where('creator_id', Auth::id())->exists();
 }
 /**
  * Regular registrations are where the Head Coach registers on
  * behalf of the Quizmaster.
  */
 public function postRegistration(QuizmasterRegistrationRequest $request, $slug, QuizmasterRegistrar $quizmasterRegistrar)
 {
     $tournament = Tournament::where('slug', $slug)->firstOrFail();
     $quizmasterRegistrar->register($tournament, $request->except('_token'), null, Session::group());
     return redirect('/tournaments/' . $tournament->slug . '/group')->withFlashSuccess('Quizmaster has been added');
 }
 public function index()
 {
     return view('tournaments.admin.index', ['tournaments' => Tournament::where('season_id', Session::season()->id)->where('creator_id', Auth::user()->id)->orderBy('start', 'DESC')->get()]);
 }