xxxxxxxxxx
<select class="form-control select" name="country[]" multiple>
@foreach (getCountries() as $key => $item)
@if(\Str::contains($task->options->require_countries, $key))
<option value="{{ $key }}" selected>{{ $item['country'] }}</option>
@else
<option value="{{ $key }}">{{ $item['country'] }}</option>
@endif
@endforeach
</select>
xxxxxxxxxx
<select class="form-multi-select" id="ms1" multiple data-coreui-search="true">
<option value="0">Angular</option>
<option value="1">Bootstrap</option>
<option value="2">React.js</option>
<option value="3">Vue.js</option>
<optgroup label="backend">
<option value="4">Django</option>
<option value="5">Laravel</option>
<option value="6">Node.js</option>
</optgroup>
</select>
xxxxxxxxxx
<label for="searchSkills">{{__('Search skills')}}</label>
<div class="quform-input">
<select class="searchSkills form-control"
multiple="multiple"id="searchSkills" name="searchSkills[]">
</select>
</div>
<script>
$(document).ready(function () {
$("#{{$route}}").select2({
tags: true,
ajax: {
url: '{{ route("$route") }}',
type: "get",
delay: 250,
dataType: 'json',
data: function (params) {
return {
name: params.term,
_token: "{{ csrf_token() }}"
};
},
processResults: function (response) {
return {
results: $.map(response, function (item) {
return {
id: item.id,
text: item.name
}
})
};
},
}
})
});
</script>
xxxxxxxxxx
$top_orders = OrderItem::select('name','productId', DB::raw('count(name) as total'))
->groupBy('name','productId')
->orderBy('total','desc')
->take(5)
->get();
xxxxxxxxxx
$myTable = MyTable->select('firstField');
if ($somethingTrue) {
$myTable->addSelect('secondField');
}
if ($somethingElseTrue) {
$myTable->addSelect('thirdField');
}
$myTable->get();