/** * 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); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $judge_licence = JudgeLicence::findOrFail($id); $judge = Judge::where('LICENCJA_SEDZIEGO_ID_LIC_S', $id)->first(); if (!empty($judge)) { $text = 'Nie mozna usunac - posiada przypisanego sedziego (' . $judge->IMIE . ' ' . $judge->NAZWISKO . ')'; return redirect()->route('judge_licences.index')->with('message', $text); } $judge_licence->delete(); return redirect()->route('judge_licences.index')->with('message', 'Item deleted successfully.'); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $judge = Judge::findOrFail($id); $judge->delete(); return redirect()->route('judges.index')->with('message', 'Item deleted successfully.'); }