bega updates

This commit is contained in:
Mekan1206
2026-07-21 21:30:27 +05:00
parent 6093a45761
commit db94922e9a
22 changed files with 1033 additions and 26 deletions

View File

@@ -0,0 +1,26 @@
<?php
namespace App\Http\Controllers\Api\V1\FlashSale\Resources;
use App\Http\Controllers\Api\V1\Product\Resources\ProductIndexResource;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class FlashSaleResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
return [
'id' => $this->whenHas('id'),
'title' => $this->whenHas('title'),
'starts_at' => $this->starts_at?->toISOString(),
'ends_at' => $this->ends_at?->toISOString(),
'products' => ProductIndexResource::collection($this->whenLoaded('products')),
];
}
}