@props([ 'label' => null, 'options' => [], 'help' => null, 'switch' => false, 'model' => null, 'lazy' => false, ]) @php if ($lazy) $bind = 'lazy'; else $bind = 'defer'; $wireModel = $attributes->whereStartsWith('wire:model')->first(); $key = $attributes->get('name', $model ?? $wireModel); $id = $attributes->get('id', $model ?? $wireModel); $prefix = null; $options = Arr::isAssoc($options) ? $options : array_combine($options, $options); $attributes = $attributes->class([ 'form-check-input', 'is-invalid' => $errors->has($key), ])->merge([ 'type' => 'radio', 'name' => $key, 'wire:model.' . $bind => $model ? $prefix . $model : null, ]); @endphp
@foreach($options as $optionValue => $optionLabel)
@php($optionId = $id . '_' . $loop->index) merge(['id' => $optionId, 'value' => $optionValue]) }}> @if($loop->last) @endif
@endforeach