@php /** @var array|bool $address */ $address = $address ?? false; // if address exists, input prefix will be "addresses[{address->id}]" // if not, it will be null and will be added by javascript later $inputPrefix = 'addresses[' . ($address ? $id : 'new') . ']'; @endphp