initial commit
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<?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')),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user