/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $team = Team::findOrFail($id); $coaches = Coatch::get(); if (empty($coaches)) { return redirect()->route('coatches.index')->with('message', 'Najpierw dodaj Trenera.'); } return view('teams.edit', compact('team'))->with('coaches', $coaches); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $coatch = Coatch::findOrFail($id); $team = Team::where('TRENER_ID_TRENER', $id)->first(); if (!empty($team)) { $text = 'Nie mozna usunac - posiada przypisaną druzynę (' . $team->NAZWA . ')'; return redirect()->route('coatches.index')->with('message', $text); } $coatch->delete(); return redirect()->route('coatches.index')->with('message', 'Item deleted successfully.'); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $coatch_licence = CoatchLicence::findOrFail($id); $coatch = Coatch::where('LICENCJA_TRENERSKA_ID_LIC_TR', $id)->first(); if (!empty($coatch)) { \Session::flash('alert-class', 'alert-danger'); return redirect()->route('coatch_licences.index')->with('message', 'Nie mozna usunac - posiada przypisanego trenera: ' . $coatch->NAZWISKO); } $coatch_licence->delete(); \Session::flash('alert-class', 'alert-warning'); return redirect()->route('coatch_licences.index')->with('message', 'Item deleted successfully.'); }