我试图通过在我的composer.json
文件中加载v5.4来在laravel5.5上使用Laravelcollective/html
,但是没有成功。以下是composer.json
文件中的代码:
"laravelcollective/html":"^5.4.0",
并将其加载到我的应用程序配置文件app.php
:providers数组中
Collective\Html\HtmlServiceProvider::class,
但在我使用刀片代码创建表单后,它不起作用,下面是刀片代码。
{!! Form::open(['route' => 'posts.store']) !!}
{{Form::label('title','Title:')}}
{{Form::text('title', null, array('class' => 'form-control') )}}
{!! Form::close() !!}
发布于 2017-09-25 01:23:54
通过终端/命令安装laravelcollective/html
:
composer require laravelcollective/html:^5.5.0
在app/config/app.php
中,添加以下内容:
'providers' => [
// ...,
Collective\Html\HtmlServiceProvider::class,
// ...
],
'aliases' => [
// ...,
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
// ...
],
在您的刀片文件中:
{!! Form::open(['route' => 'posts.store']) !!}
{!! Form::label('title', 'Title:') !!}
{!! Form::text('title', null, array('class' => 'form-control')) !!}
{!! Form::close() !!}
发布于 2019-05-03 01:55:33
您可以使用此命令
composer require --update-with-all-dependencies "laravelcollective/html 5.6.*"... since you are using laravel 5.5 the command to use will be
composer require "laravelcollective/html 5.5.*"
发布于 2017-09-25 01:00:06
您还必须将以下内容添加到别名数组中:
'aliases' => [
// ...
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
// ...
],
https://stackoverflow.com/questions/46392542
复制相似问题