/** * Display a listing of the resource. * * @return Response */ public function index() { if (isset($_GET['buscar'])) { $buscar = Input::get('buscar'); $facturas = Factura::orderBy('id', 'DESC')->where('fecha_fac', 'LIKE', '%' . $buscar . '%')->orwhere('n_factura', 'LIKE', '%' . $buscar . '%')->orwhere('n_control', 'LIKE', '%' . $buscar . '%')->orwhere('n_nota_debito', 'LIKE', '%' . $buscar . '%')->orwhere('n_nota_credito', 'LIKE', '%' . $buscar . '%')->orwhere('n_fact_ajustada', 'LIKE', '%' . $buscar . '%')->orwhere('total_compra', 'LIKE', '%' . $buscar . '%')->orwhere('exento', 'LIKE', '%' . $buscar . '%')->orwhere('base_imp', 'LIKE', '%' . $buscar . '%')->orwhere('impuesto_iva', 'LIKE', '%' . $buscar . '%')->orwhere('iva_retenido', 'LIKE', '%' . $buscar . '%')->paginate(10); $facturas->each(function ($facturas) { $facturas->reporte; }); } else { $facturas = Factura::orderBy('id', 'DESC')->paginate(10); $facturas->each(function ($facturas) { $facturas->reporte; }); } //dd($facturas); $totalFacturas = DB::table('facturas')->count(); $contador = 0; return View::make('facturas.index', array('totalFacturas' => $totalFacturas))->with('facturas', $facturas)->with('contador', $contador); //var_dump($facturas); }
public function getListado() { $facturas = Factura::orderBy('id', 'desc')->paginate(2); return View::make('facturas.listado')->with(compact('facturas')); }