Basic signup for events

This commit is contained in:
2026-03-21 21:02:15 +01:00
parent 23af267896
commit b8341890d3
74 changed files with 4046 additions and 947 deletions

View File

@@ -0,0 +1,34 @@
<?php
namespace App\Resources;
use App\RelationModels\EventParticipationFee;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class ParticipationFeeTypeResource extends JsonResource
{
public function __construct(private EventParticipationFee $participationFee) {}
public function toArray(Request $request): array
{
$return = [
'type' => new ParticipationTypeResource($this->participationFee->type()->first())->toArray($request),
'name' => $this->participationFee->name,
'description' => $this->participationFee->description,
'amount_standard' => ['internal' => $this->participationFee->amount_standard, 'readable' => $this->participationFee->amount_standard->toString()],
'amount_reduced' => ['internal' => null, 'readable' => null],
'amount_solidarity' => ['internal' => null, 'readable' => null],
];
if ($this->participationFee->amount_reduced !== null) {
$return['amount_reduced'] = ['internal' => $this->participationFee->amount_reduced, 'readable' => $this->participationFee->amount_reduced->toString()];
}
if ($this->participationFee->amount_solidarity !== null) {
$return['amount_solidarity'] = ['internal' => $this->participationFee->amount_solidarity, 'readable' => $this->participationFee->amount_solidarity->toString()];
}
return $return;
}
}