$get inside loop null, outside loop it is not

I am trying to access the $get of a wizard multi step form, but I can't access it inside my loop.
The strange thing outside of the loop it works. Event when I try to store the value of $get in a variable and I try to access it inside loop, no success.

foreach ($items as $item) {
            dd($get('purchase_price'));
            if ($item['cost_type'] === PurchasedCostsType::SetAmount->value) {
                $sumInCents += round(floatval($item['cost']) * 100);
            } elseif ($item['cost_type'] === PurchasedCostsType::Percentage->value) {
                $sumInCents += floatval($get('purchase_price')) * round(floatval($item['percent']) / 100, precision: 4);
            }
        }
Was this page helpful?