pedi2/app/Http/Resources/SubpedidoResource.php

31 lines
930 B
PHP

<?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->totalSinBDT(),0),
'subtotal_bonos' => number_format($this->getSubtotalBonos(),0),
'bonos_de_transporte' => $this->cantidadBDT(),
'subtotal_bonos_de_transporte' => number_format($this->getSubtotalBDT(),0),
'total' => number_format($this->getTotal(),0),
'grupo_de_compra' => $this->grupoDeCompra,
'productos' => $this->productos,
'aprobado' => (bool) $this->aprobado
];
}
}