<?php namespace App\Http\Resources; use Illuminate\Http\Resources\Json\JsonResource; class GrupoDeCompraResource 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, 'pedidos' => $this->subpedidos, 'total_a_recaudar' => $this->totalARecaudar(), 'total_barrial' => $this->totalBarrial(), 'total_a_transferir' => $this->totalATransferir(), 'total_transporte' => $this->totalTransporte(), 'cantidad_transporte' => number_format($this->cantidadTransporte(),0), ]; } }