events->getById($eventId, false); $participationFee = $event->firstParticipationFee(); $eventResource = $event->toResource(); $feeTypes = array_map(function (string $feeType) use ($event, $eventResource, $participationFee) { $amount = $participationFee === null ? new Amount(0, 'Euro') : $eventResource->calculateAmount( $participationFee->type, $feeType, $event->start_date, $event->end_date, false ); return [ 'value' => $feeType, 'label' => EventParticipationFee::FEE_TYPE_LABELS[$feeType], 'amount' => $amount->toString(), 'amountValue' => $amount->getAmount(), ]; }, $participationFee?->availableFeeTypes() ?? ['standard']); return response()->json(['feeTypes' => $feeTypes]); } }