Handling of event addons

This commit is contained in:
2026-08-12 17:18:45 +02:00
parent 085299336e
commit 6e4e6b645c
74 changed files with 3072 additions and 95 deletions
@@ -0,0 +1,26 @@
<?php
namespace App\Resources;
use App\Models\EventParticipantAddon;
use Illuminate\Http\Resources\Json\JsonResource;
class EventParticipantAddonResource extends JsonResource
{
function __construct(EventParticipantAddon $addon)
{
parent::__construct($addon);
}
public function toArray($request): array
{
return [
'addonKey' => $this->resource->addon_key,
'title' => $this->resource->title,
'flat' => $this->resource->flat,
'amount' => $this->resource->amount?->getAmount() ?? 0,
'amountReadable' => $this->resource->amount?->toString() ?? '0,00 Euro',
'free' => ($this->resource->amount?->getAmount() ?? 0) <= 0,
];
}
}