<x-form.group label="{{ $label ?? $name }}" class="{{ $classGroup ?? '' }}">
    <select @if(isset($multiple))multiple @endif class="form-control select2{{ $errors->has($name) ? ' is-invalid' : '' }}" name="{{ isset($multiple) ?$name.'[]':$name }}">
    @if(isset($multiple))

        @foreach($items as $item)
            <option value="{{ $item->{$choiceValue??'id'} }}" {{ isset($value)&& in_array($item->{$choiceValue??'id'},$value) ?'selected':'' }}>{{ $item->{$choiceLabel??'name'} }}</option>
        @endforeach
    @else
        @foreach($items as $item)
            <option value="{{ $item->{$choiceValue??'id'} }}" {{ isset($value)&&$item->{$choiceValue??'id'}==$value ?'selected':'' }}>{{ $item->{$choiceLabel??'name'} }}</option>
        @endforeach
    @endif

    </select>
    @if ($errors->has($name)) 
    <div class="invalid-feedback">
        {{  $errors->first($name) }}
    </div>
    @endif
</x-form.group>