xxxxxxxxxx
$myTable = MyTable->select('firstField');
if ($somethingTrue) {
$myTable->addSelect('secondField');
}
if ($somethingElseTrue) {
$myTable->addSelect('thirdField');
}
$myTable->get();
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
$top_orders = OrderItem::select('name','productId', DB::raw('count(name) as total'))
->groupBy('name','productId')
->orderBy('total','desc')
->take(5)
->get();