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

35 lines
1.2 KiB
PHP

<?php
namespace App\Endpoint\Api\Http\Resources\Dealer;
use Illuminate\Http\Resources\Json\JsonResource;
class DealerDeliveryBillResource 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,
'sn' => $this->sn,
'shipping_fee' => $this->shipping_fee,
'remark' => $this->remark,
'consignee_name' => $this->consignee_name,
'consignee_telephone' => $this->consignee_telephone,
'consignee_zone' => $this->consignee_zone,
'consignee_address' => $this->consignee_address,
'delivery_products' => DealerDeliveryProductResource::collection($this->whenLoaded('deliveryProducts')),
'pay_sn' => $this->pay_sn,
'pay_way' => $this->pay_way,
'pay_at' => $this->pay_at?->toDateTimeString(),
'status' => $this->status,
'created_at' => $this->created_at->toDateTimeString(),
];
}
}