2016-09-26 117 views
0

我使用Laravel/Collective作为Laravel 5中的表单助手,但是当我创建我的表单时,它仅输出html标记,而不是预期的窗体控件。Laravel 5 - Laravel Collective

我在我的composer.json中添加了“laravelcollective/html”:“〜5.0”,运行了作曲家更新。

在config.app和'Form'=>'Collective \ Html \ FormFacade','Html'=>'Collective \ Html \ HtmlFacade'中为供应商数组添加了'Collective \ Html \ HtmlServiceProvider'别名数组在config.app文件中。

我的表格代码: {!形式::模型($货币,[ '路线'=> [ 'currency.update',$ currency-> ID], '方法'=> 'PUT'])!}

  {{ Form::label('currency', 'Currency Code: ', ['class'=>'col-sm-3 control-label']) }} 
      {{ Form::text('currency', null, ['class'=>'form-control']) }} 

      {{ Form::label('description', 'Currency Description: ', ['class'=>'col-sm-3 control-label']) }} 
      {{ Form::text('description', null, ['class'=>'form-control']) }} 

      {{ Form::label('is_active', 'Is Active? ', ['class'=>'col-sm-3 control-label'])}} 
      {{ Form::checkbox('is_active', $currency->is_active) }} 

      {{ Form::button('Submit') }} 

      {!! Form::close() !!} 

输出是HTML标记:

<label for="currency" class="col-sm-3 control-label">Currency Code: </label> <input class="form-control" name="currency" type="text" value="GBP" id="currency"> <label for="description" class="col-sm-3 control-label">Currency Description: </label> <input class="form-control" name="description" type="text" value="British Pound" id="description"> <label for="is_active" class="col-sm-3 control-label">Is Active? </label> <input name="is_active" type="checkbox" value="0" id="is_active"> <button type="button">Submit</button>

我知道它可能是一些愚蠢的我错过了,但我一直难倒到目前为止,任何帮助或建议,将不胜感激。谢谢

回答

0

我的猜测是laravel正在逃避输出。尝试在{!中包装你的代码! !!}代替。

像这样:

{!! Form::label('currency', 'Currency Code: ', ['class'=>'col-sm-3 control-label']) !!} 
{!! Form::text('currency', null, ['class'=>'form-control']) !!}