@props(['name', 'label' => null, 'options' => [], 'value' => null, 'placeholder' => null, 'hint' => null]) @php($key = str_replace(['[', ']'], ['.', ''], $name)) {{-- errors and old input use dot keys --}} @php($selected = (string) old($key, $value instanceof \BackedEnum ? $value->value : $value)) @php($id = $attributes->get('id', $name)) @php($groups = is_array(collect($options)->first()) ? $options : ['' => $options]) {{-- options can be grouped: group label => [value => label] --}}
{{ $hint }}
@endif @error($key){{ $message }}
@enderror