@props([ 'name', 'options' => null, 'label' => '', 'class' => '', 'selected' => null, 'multiple' => null, 'errorName' => null, 'placeholder' => null, 'optionKey' => 'id', 'optionName' => 'name', 'additionalData' => [], 'star' => false, ]) @php $errorName ??= dotted_string($name); $splitAttributes = implode(' ', explode(' ', $attributes)); $invalidClass = $errors->has($errorName) ? 'is-invalid' : ''; $defaultPlaceHolder = $placeholder ?? __('Select') . ' ' . $label; $class = "{$invalidClass} form-control {$class}"; $splitAttributes .= $multiple === true ? '$multiple' : false; $selected = $selected ?? (isset($model) ? old($name, $model->{$name}) : old($name)); if ($additionalData) { $dataAttributes = []; foreach ($additionalData as $key => $row) { $dataAttributes[$key] = ''; foreach ($row as $attr => $val) { $dataAttributes[$key] .= ' ' . $attr . '="' . $val . '"'; } } } @endphp