简体   繁体   English

无法在Laravel 5中创建表单标签

[英]Unable to create form tag in Laravel 5

Directory structure. 目录结构。

在此处输入图片说明

My current code is below 我当前的代码如下

{{ Form::open(array('action' =>  'SkillsController@store', 'method'  =>  'POST' }}

{{ Form::close() }}

I got the following error 我收到以下错误

Class 'Form' not found 找不到“表格”类

{{!! Form::open(array('action' =>  'SkillsController@store', 'method'  =>  'POST'}}

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

Still I am facing the same issue. 我仍然面临着同样的问题。

Reference 参考

As of Laravel 5, Form helpers were removed and are now maintained and provided by the Laravel Collective. 从Laravel 5开始,Laravel Collective已删除了表单助手,并且现在对其进行维护和提供。

The steps provided in their docs : 他们的文档中提供的步骤:

  1. Add "laravelcollective/html": "5.1.*" to the require section of your composer.json file "laravelcollective/html": "5.1.*"composer.json文件的require部分
  2. Run composer update 运行composer update
  3. Add Collective\\Html\\HtmlServiceProvider::class, to your array of providers in the congif/app.php file congif/app.php文件中Collective\\Html\\HtmlServiceProvider::class,Collective\\Html\\HtmlServiceProvider::class,添加到提供程序数组中
  4. Add 'Form' => Collective\\Html\\FormFacade::class, and 'Html' => Collective\\Html\\HtmlFacade::class, to your array of aliases in the config/app.php file 'Form' => Collective\\Html\\FormFacade::class,'Html' => Collective\\Html\\HtmlFacade::class,config/app.php文件中的别名数组

You'll then be able to use them in your views using {!! !!} 然后,您可以使用{!! !!} {!! !!} in your views, like so: {!! !!}在您看来,如下所示:

{!! Form::open(array('url' => 'foo/bar')) !!}
    //
{!! Form::close() !!}

In laravel 5 HTML, and forms not included you should include manually, can follow instructions in this link. 在laravel 5 HTML中,您应该手动添加未包含的表格,可以按照此链接中的说明进行操作。 http://laravel.io/forum/09-20-2014-html-form-class-not-found-in-laravel-5 http://laravel.io/forum/09-20-2014-html-form-class-not-found-in-laravel-5

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM