/** * Remove the specified categroy from database. * * @param int $id * @return Response */ public function destroy($id) { $supplier = Suppliers::find($id); $check = new Suppliers(); $error = "You can not delete this supplier because some products depend on it"; if ($check->exists($id) == true) { return Redirect::to('suppliers')->with('error', $error); } else { $supplier->delete(); } // redirect return Redirect::to('suppliers'); }