6
0
Fork 0
jiqu-library-server/app/Endpoint/Api/Http/Resources/OrderProductResource.php

28 lines
731 B
PHP

<?php
namespace App\Endpoint\Api\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class OrderProductResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
*/
public function toArray($request)
{
return [
'id' => $this->id,
'sku_id' => $this->sku_id,
'name' => $this->name,
'cover' => $this->cover,
'specs' => array_values((array) $this->specs),
'quantity' => $this->quantity,
'total_amount' => $this->total_amount_format,
];
}
}