Laravel 4刀片下拉列表类属性

Gra*_*avy 30 html-select laravel blade

Laravel刀片下拉列表类属性不起作用.

我找不到任何类的引用或为文档中的选择/下拉列表分配属性.

http://www.laravel.com/docs/html#drop-down-lists

试过的例子:

{{ Form::select('product_id', $productList, array('class'=>'form-control')) }}

{{ Form::select('product_id', $productList, $attributes = array('class'=>'form-control')) }}
Run Code Online (Sandbox Code Playgroud)

两者都返回相同的html但没有class属性:

<select id="product_id" name="product_id">
    ... Option Stuff ...
</select>
Run Code Online (Sandbox Code Playgroud)

Bas*_*ann 72

{{ Form::select('product_id', $productList, null, array('class' => 'form-control')) }}
Run Code Online (Sandbox Code Playgroud)

第三个参数是当前所选选项的键.默认为null.

  • 谢谢你...我希望在文档中写出这么简单的内容! (4认同)
  • 您可以随时查看来源.如果你使用sublime文本命中`cmd + t`并输入`FormBuilder`.记住框架是你的应用程序的一部分,只是因为你无法直接更改源代码并不意味着你不应该熟悉那里的代码. (2认同)