27 lines
743 B
PHP
27 lines
743 B
PHP
<?php
|
|
|
|
namespace App\Endpoint\Api\Http\Resources\Dealer;
|
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class OrderSimpleResource 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,
|
|
'total_amount' => $this->total_amount,
|
|
'created_at' => $this->created_at->toDateTimeString(),
|
|
'status' => $this->status,
|
|
'products' => OrderProductResource::collection($this->whenLoaded('products')),
|
|
];
|
|
}
|
|
}
|