/** * Show the form for creating a new resource. * * @return Response */ public function create() { $teams = Team::get(); if (empty($teams)) { return redirect()->route('teams.index')->with('message', 'Najpierw dodaj druzyne.'); } $judges = Judge::get(); if (empty($judges)) { return redirect()->route('judges.index')->with('message', 'Najpierw dodaj sedziego.'); } $champions = Championship::get(); if (empty($champions)) { return redirect()->route('championships.index')->with('message', 'Najpierw dodaj rozgrywki.'); } $arenas = Arena::get(); if (empty($arenas)) { return redirect()->route('arenas.index')->with('message', 'Najpierw dodaj stadion.'); } return view('games.create')->with('teams', $teams)->with('judges', $judges)->with('champions', $champions)->with('arenas', $arenas); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $player = Player::findOrFail($id); $teams = Team::get(); $positions = PlayerPosition::get(); return view('players.edit', compact('player'))->with('teams', $teams)->with('positions', $positions); }