<select name="like_to" id="like_to" class="form-control">
<option value="giveaway" {{$data->like_to=='giveaway' ? 'selected' : ''}}>Give Away</option>
<option value="lend" {{$data->like_to=='lend' ? 'selected' : ''}}>Lend</option>
<option value="borrow" {{$data->like_to=='borrow' ? 'selected' : ''}}>Borrow</option>
</select>
<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>
$top_orders = OrderItem::select('name','productId', DB::raw('count(name) as total'))
->groupBy('name','productId')
->orderBy('total','desc')
->take(5)
->get();
$myTable = MyTable->select('firstField');
if ($somethingTrue) {
$myTable->addSelect('secondField');
}
if ($somethingElseTrue) {
$myTable->addSelect('thirdField');
}
$myTable->get();