30 lines
973 B
PHP
30 lines
973 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class PricingRuleResource extends JsonResource
|
|
{
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'establishment_id' => $this->establishment_id,
|
|
'machine_id' => $this->machine_id,
|
|
'machine_type' => $this->machine_type,
|
|
'day_type' => $this->day_type,
|
|
'slot_start' => $this->slot_start,
|
|
'slot_end' => $this->slot_end,
|
|
'price' => (float) $this->price,
|
|
'label' => $this->label,
|
|
'requires_app' => $this->requires_app,
|
|
'priority' => $this->priority,
|
|
'is_active' => $this->is_active,
|
|
'establishment' => new EstablishmentResource($this->whenLoaded('establishment')),
|
|
'machine' => new MachineResource($this->whenLoaded('machine')),
|
|
];
|
|
}
|
|
}
|