pedi2/app/Http/Resources/SubpedidoResource.php

30 lines
889 B
PHP
Raw Permalink Normal View History

<?php
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class SubpedidoResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
{
return [
'id' => $this->id,
'nombre' => $this->nombre,
'subtotal_productos' => number_format($this->getSubtotalProductos(),2),
'subtotal_bonos' => number_format($this->getSubtotalBonos(),2),
'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,
'productos' => $this->productos
];
}
}