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

34 lines
1.1 KiB
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),
'sell_price' => $this->sell_price_format,
'vip_price' => $this->vip_price_format,
'total_amount' => $this->total_amount,
'quantity' => $this->quantity,
'remain_quantity' => $this->remain_quantity,
'can_after_sale' => $this->can_after_sale,
'has_after_sale' => $this->has_after_sale, //显示【查看售后】按钮判断
'is_gift' => $this->isGift(),
];
}
}