Handling of event addons
This commit is contained in:
1 parent
085299336e
commit
6e4e6b645c
74 files changed
+3072
-95
No files matched your search
@@ -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,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user