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