/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { if (count(Causa::where('problema_id', $id)->get()) > 0) { return new AjaxResponse('error', 'Existen causas raíz asociadas a este problema. No se puede eliminar'); } $record = Problema::find($id)->delete(); return new AjaxResponse('success', ''); }