/** * 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.'); }