how do I change this php select to laravel forms?
<div class="form-group">
<label for="title">Food</label>
<select id="food" name="food_id" class="form-control" style="width:350px">
<option value="">--- Choose Food ---</option>
@foreach ($foods as $key => $value)
<option value="{{ $key }}">{{ $value }}</option>
@endforeach
</select>
</div>
is it like this?
<div class="form-group">
<label for="title">Food</label>
{!! Form::select('food_id', $foods, $key => $value, ['class'=>'form-control', 'placeholder' => '--- Choose Food ---']) !!}
</div>
but it doesnt work
edit
actually i pass by ajax
$('select[id="food"]').on('change', function() {
var foodID = $(this).val();
if(foodID) {
...
...
Form::select('food_id', $foods, null, ['class'=>'form-control', 'placeholder' => '--- Choose Food ---','id'=>'food']);
Third parameter is currently selected option key. Default is null.