@props([ 'label' => null, 'placeholder' => null, 'options' => [], 'icon' => null, 'prepend' => null, 'append' => null, 'size' => null, 'help' => null, 'model' => null, 'lazy' => false, 'defer' => true, 'direction' => '', 'rowWidth' => 9, 'select2' => true, 'select2search' => -1, 'select2allowclear' => false, 'formGroupClass' => '', 'idPrepend' => null, 'outlined' => null, ]) @php $bind = ''; if ($lazy) $bind = '.lazy'; else if ($defer) $bind = '.defer'; $wireModel = $attributes->whereStartsWith('wire:model')->first(); $key = $attributes->get('name', $model ?? $wireModel); $id = $attributes->get('id', $model ?? $wireModel); $id = $idPrepend ? $idPrepend . '-' . $id : $id; $prefix = null; $options = Arr::isAssoc($options) ? $options : array_combine($options, $options); $isRow = $direction === 'row'; $attributes = $attributes->class([ 'form-control', 'form-select', 'form-select-' . $size => $size, 'rounded-end' => !$append, 'is-invalid' => $errors->has($key), ])->merge([ 'id' => $id, 'wire:model' . $bind => $model ? $prefix . $model : null, ]); @endphp