我是新來的PHP框架,我正在使用Laravel創建一個CRUD應用程序。問題是,當我試圖通過從DB從View值一類的Id我得到的錯誤:Laravel 5將ID從數據庫傳遞到<select>的值
htmlentities() expects parameter 1 to be string, array given (View: C:\wamp\www\vecrud\resources\views\products\create.blade.php)
控制器
public function create()
{
$products_create = categories::all()->lists('category');
$categ_id = categories::all()->lists('id');
return View::make('products.create', compact('products_create', 'categ_id'));
}
查看
{!! Form::label('category', 'Categorie') !!} <br />
{!! Form::select('category', $products_create, Input::old('category'), array('value' => $categ_id)) !!}