Files
backend/src/app/Http/Resources/PromotionResource.php
T
bastien d95bfa6c58
Laverie/backend/pipeline/head There was a failure building this commit
Jenkins file
2026-07-04 22:42:58 +02:00

26 lines
830 B
PHP

<?php
namespace App\Http\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class PromotionResource extends JsonResource
{
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'establishment_id' => $this->establishment_id,
'machine_type' => $this->machine_type,
'discount_type' => $this->discount_type,
'discount_value' => (float) $this->discount_value,
'starts_at' => $this->starts_at?->toIso8601String(),
'ends_at' => $this->ends_at?->toIso8601String(),
'description' => $this->description,
'is_active' => $this->is_active,
'establishment' => new EstablishmentResource($this->whenLoaded('establishment')),
];
}
}