/** * @param $name * @param null $selected * @param array $options * * @return string */ public function selectParticipantType($name, $selected = null, $options = [], $optional = false) { $list = []; foreach (ParticipantType::orderBy('name')->get() as $participantType) { $list[$participantType->id] = $participantType->name; } if ($optional) { array_unshift($list, 'Select One...'); } return $this->select($name, $list, $selected, $options); }
/** * @param TournamentCreatorOnlyRequest $request * * @return \Illuminate\View\View */ public function edit(TournamentCreatorOnlyRequest $request, $id) { $tournament = Tournament::with('participantFees')->findOrFail($id); return view('tournaments.admin.edit', ['tournament' => $tournament, 'participantFees' => $tournament->participantFees->keyBy('participant_type_id'), 'participantTypes' => ParticipantType::orderBy('name', 'ASC')->get()]); }