@php
$optionRows = old('options', $options->map(fn ($option) => [
'value' => $option->value,
'label' => $option->label,
])->all());
// Always leave a blank row so an editor can add one without a button press.
$optionRows = array_values($optionRows);
$optionRows[] = ['value' => '', 'label' => ''];
$validation = $record->validation ?? [];
@endphp
@if ($record->exists)
{{-- The code is referenced by stored values, query strings and saved
searches, so it is deliberately not editable after creation. --}}
Code
{{ $record->code }}
Fixed once created — listings and saved searches reference it.
@else
@endif
{{--
Options only mean anything for the two choice types. The block stays in the
DOM either way so switching type does not lose what was typed, but the server
discards options for a type that cannot use them.
--}}
@foreach ($optionRows as $index => $row)
{{ $index + 1 }}
@endforeach
Clearing both fields on a row removes that option. Listings already holding a removed
value keep it — it simply stops being offered.