27 lines
781 B
PHP
27 lines
781 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources\Order;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class OrderItemInfoResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->variant->product_id,
|
|
'product_image_url_snapshot' => $this->product_image_url_snapshot,
|
|
'product_name_snapshot' => $this->product_name_snapshot,
|
|
'product_variant_name_snapshot' => $this->product_variant_name_snapshot,
|
|
'selling_price_snapshot' => (float) $this->selling_price_snapshot,
|
|
'quantity' => (int) $this->quantity
|
|
];
|
|
}
|
|
}
|