如何将我的html表单更改为laravel集体表单
<select style="width:50%;margin-top: 10px;" name="idw">
<option value="0" disabled="true" selected="true">choose</option>
@foreach($warehouse as $w)
<option value="{{$w->id}}" name="idw" id="idw">{{$w->name}}</option>
@endforeach
</select>
以我的集体形式
{!! Form::select('type',
['Task' => $w->id =>w-> $name ],
null,
['class' => 'form-control chosen-type', 'placeholder' => 'Please Choose']
)!!}
我在
之前使用集体形式答案 0 :(得分:5)
以您的形式:
<div class="form-group">
{{ Form::label('Warehouses') }}
{{ Form::select('warehouse', $warehouseList, null, array('class'=>'form-control', 'placeholder'=>'Please select ...')) }}
</div>
在您的控制器中:
$warehouseList = Warehouse::all()->sortBy('name', SORT_NATURAL | SORT_FLAG_CASE)->pluck('name', 'id');