From 89c9a852041419bdeeb7fce89064aed59efbf845 Mon Sep 17 00:00:00 2001 From: nat Date: Wed, 16 Mar 2022 23:56:51 -0300 Subject: [PATCH] endpoint devuelve lista de productos en el subpedido, con su cantidad y subtotal --- app/Http/Resources/SubpedidoResource.php | 3 ++- app/Subpedido.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Http/Resources/SubpedidoResource.php b/app/Http/Resources/SubpedidoResource.php index f659379..e83492f 100644 --- a/app/Http/Resources/SubpedidoResource.php +++ b/app/Http/Resources/SubpedidoResource.php @@ -22,7 +22,8 @@ class SubpedidoResource extends JsonResource 'bonos_de_transporte' => $this->cantidadBDT(), 'subtotal_bonos_de_transporte' => number_format($this->getSubtotalBDT(),2), 'total' => number_format($this->getTotal(),2), - 'grupo_de_compra' => $this->grupoDeCompra + 'grupo_de_compra' => $this->grupoDeCompra, + 'productos' => $this->productos ]; } } diff --git a/app/Subpedido.php b/app/Subpedido.php index 0cfb039..b7a9489 100644 --- a/app/Subpedido.php +++ b/app/Subpedido.php @@ -15,7 +15,7 @@ class Subpedido extends Model public function productos() { - return $this->belongsToMany('App\Producto')->withPivot(["cantidad"]); + return $this->belongsToMany('App\Producto')->withPivot(["cantidad","total"]); } //Bonos del MPS, Sororo, etc. NO devuelve bonos de transporte