コード例 #1
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $facturas = Factura::find($id);
     if (is_null($facturas)) {
         App::abort(404);
     }
     $facturas->delete();
     if ($facturas->n_factura == '' && $facturas->n_nota_credito == '') {
         return Redirect::route('reportes.show', array($facturas->id_reporte))->with('delete', 'La nota de débito <b>' . $facturas->n_nota_debito . '</b> ha sido eliminada correctamente.');
     } elseif ($facturas->n_factura == '' && $facturas->n_nota_debito == '') {
         return Redirect::route('reportes.show', array($facturas->id_reporte))->with('delete', 'La nota de crédito <b>' . $facturas->n_nota_credito . '</b> ha sido eliminada correctamente.');
     } else {
         return Redirect::route('reportes.show', array($facturas->id_reporte))->with('delete', 'La factura <b>' . $facturas->n_factura . '</b> ha sido eliminada correctamente.');
     }
 }
コード例 #2
0
 public function getAlCarrito($idFactura)
 {
     try {
         $factura = Factura::find($idFactura);
         $factura->alCarrito();
         Session::flash('mensajeOk', 'Se han agregado al carrito los items de la factura ' . $idFactura);
         return Redirect::to('carrito');
     } catch (Exception $e) {
         Session::flash('mensajeError', 'No fue posible cargar el carrito con los items de la factura ' . $idFactura);
         return Redirect::to('facturas/listado');
     }
 }