pedi2/app/Http/Resources/SubpedidoResource.php

29 lines
785 B
PHP
Raw 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,
'grupo_de_compra' => $this->grupoDeCompra,
2022-12-02 18:44:29 -03:00
'nombre' => $this->nombre,
'productos' => $this->productos,
2022-12-02 18:44:29 -03:00
'cantidad_bonos_de_transporte' => $this->cantidadBDT(),
'subtotal_bonos_de_transporte' => number_format($this->subtotalBDT(),0),
'total' => number_format($this->getTotal(),0),
'aprobado' => (bool) $this->aprobado
];
}
}