/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $coatch = Coatch::findOrFail($id); $licences = CoatchLicence::get(); if (empty($licences)) { return redirect()->route('coatch_licences.index')->with('message', 'Najpierw dodaj licencje.'); } return view('coatches.edit', compact('coatch'))->with('licences', $licences); }
/** * 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.'); }