Agregada información de tipo en SubpedidoResource.php
This commit is contained in:
parent
441007e66b
commit
2a2ea06875
1 changed files with 4 additions and 1 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\TipoPedido;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
|
@ -19,6 +20,7 @@ class SubpedidoResource extends JsonResource
|
|||
foreach ($productos as $producto) {
|
||||
$producto['pivot']['total'] = number_format($producto->pivot->cantidad * $producto->precio, 2);
|
||||
}
|
||||
$tipo = TipoPedido::find($this->tipo_pedido_id);
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'nombre' => $this->nombre,
|
||||
|
@ -29,7 +31,8 @@ class SubpedidoResource extends JsonResource
|
|||
'cantidad_transporte' => number_format($this->cantidadTransporte()),
|
||||
'total_sin_devoluciones' => number_format($this->totalSinDevoluciones(),2),
|
||||
'devoluciones_total' => number_format($this->devoluciones_total,2),
|
||||
'devoluciones_notas' => $this->devoluciones_notas
|
||||
'devoluciones_notas' => $this->devoluciones_notas,
|
||||
'tipo' => ['id' => $tipo->id, 'nombre' => $tipo->nombre],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue