/** * @test */ public function generatesSeasonalRegistrationDescription() { foreach (Program::all() as $program) { $item = new Item(['sku' => $program->sku]); $this->assertEquals($program->name . ' Seasonal Registration', $item->name()); } }
/** * @return \Illuminate\View\View */ public function create() { $programs = []; foreach (Program::all() as $program) { $programs[$program->id] = $program . ''; } return view('group.create')->withPrograms($programs); }
/** * @return \Illuminate\View\View */ public function create() { $programs = []; foreach (Program::all() as $program) { $programs[$program->id] = $program . ''; } return view('tournaments.admin.create', ['programs' => $programs, 'eventTypes' => EventType::orderBy('name', 'ASC')->get(), 'participantTypes' => ParticipantType::orderBy('name', 'ASC')->get(), 'defaultEventTypes' => [EventType::ROUND_ROBIN, EventType::DOUBLE_ELIMINATION]]); }
/** * @return Program */ public function programs() { if ($this->programs == null) { $programs = []; foreach (Program::all() as $program) { if ($this->numberOfPlayers($program) > 0) { $programs[] = $program; } } $this->programs = $programs; } return $this->programs; }
/** * If the group isn't found this step will direct * the parent to a later. */ public function later($programSlug) { /** @var GroupRegistration $registration */ $registration = Session::seasonalGroupRegistration(); $playersRemovedFromProgram = null; $continueRegistration = false; foreach (Program::all() as $program) { // don't register players in this program if ($program->slug == $programSlug && $registration->numberOfPlayers($program) > 0) { $registration->removePlayers($program); $playersRemovedFromProgram = $program; } // only continue if other programs have players if ($registration->numberOfPlayers($program) > 0) { $continueRegistration = true; } } Session::setSeasonalGroupRegistration($registration); if ($continueRegistration) { return redirect('/register/summary')->withFlashSuccess('Your ' . $playersRemovedFromProgram->abbreviation . ' players have been removed from this registration'); } return redirect('/dashboard'); }