【发布时间】:2017-03-20 18:57:16
【问题描述】:
我想在下拉列表中显示数据库值..我尝试了很多,但它不适合我.. 我收到错误我不知道我在哪里弄错了..我是 laravel 的新手..请帮助我在哪里弄错了..
查看:
<div class="form-group">
<label for="name" class="col-md-4 control-label">User type</label>
<div class="col-md-6">
<?php
{!!Form::select('user_type_id[]', $usertypes_list, $thing->user_type->pluck('id'), ['class' => 'form-control'])!!}
;?>
</div>
控制器:
public function get() {
$usertypes_list = User_type::lists('id', 'type');
return view('edit')->compact('user_type');
}
谁能帮帮我... 提前致谢。
【问题讨论】:
-
你能试试这个`{!! Form::select('user_type_id[]', $usertypes_list, null, ['class' => 'form-control']) !!}` 并删除
<?php ?>标签 -
当我尝试找不到此类“表单”时出现此错误
-
您是否将
laravelcollective添加到您的项目中? -
laravelcollective 是为了什么..我可以知道目的
-
Form::select不是 laravel 5+ 中的内置功能,它是一个名为laravelcollective的包,它非常常见且有用
标签: mysql laravel-5.4