resource->calculateAmount(); $singleAmountString = $this->resource->flat_amount?->toString(); $amountType = 'flat'; if ($singleAmountString === null) { $amountType = 'per_person'; $singleAmountString = $this->resource->amount_by_user->toString() . ' / Person (' . $amount->toString() . ' Gesamt)'; } else { $singleAmountString .= ' Gesamt'; } return [ 'id' => $this->resource->id, 'title' => $this->resource->description, 'singleAmountString' => $singleAmountString, 'calculatedAmount' => $amount, 'calculatedAmountString' => $amount->toString(), 'amountValue' => $amount->getAmount(), 'amountType' => $amountType, ]; } }