@endif
@if (count($field['options']))
- @foreach ($field['options'] as $key => $value)
+ @foreach ($field['options'] as $key => $data)
+ @php
+ $attrs='';
+ if(is_array($data)){
+ $value=$data['value'];
+ unset($data['value']);
+ foreach ($data as $k=>$v){
+ $attrs.=' '.$k.'="'.$v.'"';
+ }
+ }else{
+ $value=$data;
+ }
+
+ @endphp
@if(!$is_null && select2_from_array_selected($key,$o))
- <option value="{{ $key }}" selected>{{ $value }}</option>
+ <option value="{{ $key }}" selected {!! $attrs !!}>{{ $value }}</option>
@elseif(!$ajax)
- <option value="{{ $key }}">{{ $value }}</option>
+ <option value="{{ $key }}" {!! $attrs !!}>{{ $value }}</option>
@endif
@endforeach
@endif