Laravel:设置默认选项时,表单选择不使用样式/类

时间:2016-09-24 04:15:31

标签: forms twitter-bootstrap laravel select

我正在使用带有Bootstrap的Laravel 5。

当我在下面使用时,类和/或样式可以正常工作:

{!! Form::select('mylist', [''=>'-- select --'], array('id' => 'mylist'), array('class' => 'myclass', 'style' => 'width:116px)) !!}

但是,当我将$ mylist设置为我的选择表单的默认选项时(在我的编辑记录页面中),样式/类不起作用:

{!! Form::select('mylist', [''=>'-- select --'] + $mylist, $row->myfile, array('id' => 'mylist'), array('class' => 'myclass', 'style' => 'width:116px)) !!}

请建议我实现这一目标。

谢谢, 那仁

1 个答案:

答案 0 :(得分:0)

我认为这是你应该使用的正确格式

/**
 * Default model configuration
 * (sails.config.models)
 *
 * Unless you override them, the following properties will be included
 * in each of your models.
 *
 * For more info on Sails models, see:
 * http://sailsjs.org/#/documentation/concepts/ORM
 */

module.exports.models = {

  /***************************************************************************
  *                                                                          *
  * Your app's default connection. i.e. the name of one of your app's        *
  * connections (see `config/connections.js`)                                *
  *                                                                          *
  ***************************************************************************/
  connection: 'mysqlServer',

  /***************************************************************************
  *                                                                          *
  * How and whether Sails will attempt to automatically rebuild the          *
  * tables/collections/etc. in your schema.                                  *
  *                                                                          *
  * See http://sailsjs.org/#/documentation/concepts/ORM/model-settings.html  *
  *                                                                          *
  * In a production environment (NODE_ENV==="production") Sails always uses  *
  * migrate:"safe" to protect inadvertent deletion of your data.             *
  * However development has a few other options for convenience:             *
  *                                                                          *
  * safe - never auto-migrate my database(s). I will do it myself (by hand)  *
  * alter - auto-migrate, but attempt to keep existing data (experimental)   *
  * drop - wipe/drop ALL my data and rebuild models every time I lift Sails  *
  *                                                                          *
  ***************************************************************************/
  migrate: 'alter',

};