32 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| namespace App\Http\Resources;
 | |
| 
 | |
| use Illuminate\Http\Request;
 | |
| use Illuminate\Http\Resources\Json\JsonResource;
 | |
| 
 | |
| class GrupoDeCompraResource extends JsonResource
 | |
| {
 | |
|     /**
 | |
|      * Transform the resource into an array.
 | |
|      *
 | |
|      * @param  Request  $request
 | |
|      * @return array
 | |
|      */
 | |
|     public function toArray($request): array
 | |
|     {
 | |
|         return [
 | |
|             'id' => $this->id,
 | |
|             'nombre' => $this->nombre,
 | |
|             'devoluciones_habilitadas' => $this->devoluciones_habilitadas,
 | |
|             'pedidos' => SubpedidoResource::collection($this->subpedidos),
 | |
|             'total_a_recaudar' => number_format($this->totalARecaudar(),2),
 | |
|             'total_sin_devoluciones' => number_format($this->totalSinDevoluciones(),2),
 | |
|             'total_barrial' => number_format($this->totalBarrial(),2),
 | |
|             'total_devoluciones' => number_format($this->totalDevoluciones(),2),
 | |
|             'total_a_transferir' => number_format($this->totalATransferir(),2),
 | |
|             'total_transporte' => number_format($this->totalTransporte()),
 | |
|             'cantidad_transporte' => number_format($this->cantidadTransporte()),
 | |
|         ];
 | |
|     }
 | |
| }
 |