我想使用illuminate\html创建一个类似下面的 Select 框:
<select>
<option value="$item->id">$item->name</option>
<option value="$item->id">$item->name</option>
</select>
在我的控制器中,我try 了以下方法:
public function create()
{
$items = Items::all(['id', 'name']);
return view('prices.create', compact('id', 'items'));
}
在我看来,这是:
<div class="form-group">
{!! Form::Label('item', 'Item:') !!}
{!! Form::select('item_id', $items, null, ['class' => 'form-control']) !!}
</div>
The issue is that instead of $item->name
is displaying all the info of the entity.