Laravelcollective/html 在 Laravel 5.5 中不起作用

Olu*_*oye 5 php laravel laravel-5.5

我试图Laravelcollective/html通过在我的composer.json文件中加载 v5.4来使用laravel 5.5,但这没有用。这是composer.json文件中的代码:

"laravelcollective/html":"^5.4.0",
Run Code Online (Sandbox Code Playgroud)

并将其加载到我的应用程序配置文件中app.php:在 providers 数组中

Collective\Html\HtmlServiceProvider::class,
Run Code Online (Sandbox Code Playgroud)

但是在我使用刀片代码创建表单后它不起作用,这是刀片代码。

{!! Form::open(['route' => 'posts.store']) !!}

{{Form::label('title','Title:')}}

{{Form::text('title', null, array('class' => 'form-control') )}}

{!! Form::close() !!}
Run Code Online (Sandbox Code Playgroud)

emo*_*ity 5

laravelcollective/html通过终端/CMD安装:

composer require laravelcollective/html:^5.5.0
Run Code Online (Sandbox Code Playgroud)

在 中app/config/app.php,添加以下内容:

'providers' => [
    // ...,
    Collective\Html\HtmlServiceProvider::class,
    // ...
],

'aliases' => [
    // ...,
    'Form' => Collective\Html\FormFacade::class,
    'Html' => Collective\Html\HtmlFacade::class,
    // ...
],
Run Code Online (Sandbox Code Playgroud)

在您的刀片文件中:

{!! Form::open(['route' => 'posts.store']) !!}
{!! Form::label('title', 'Title:') !!}
{!! Form::text('title', null, array('class' => 'form-control')) !!}
{!! Form::close() !!}
Run Code Online (Sandbox Code Playgroud)


pse*_*ime 0

您还必须将以下内容添加到别名数组中:

'aliases' => [
// ...
  'Form' => Collective\Html\FormFacade::class,
  'Html' => Collective\Html\HtmlFacade::class,
// ...
Run Code Online (Sandbox Code Playgroud)

],