Class 'Form' 未找到(查看:/path/to/laravel/resources/views/posts/create.blade.php)

Class 'Form' not found (View: /path/to/laravel/resources/views/posts/create.blade.php)

我正在尝试使用表单,但一直收到此错误:

Class 'Form' not found

Class 'Form' not found (View: /path/to/laravel/resources/views/posts/create.blade.php)

我的create.blade.php

@section('content')
<div class="row">
  <div class="col-md-8 col-md-offset-2">
    <h1>Новая новость</h1>
    <hr>
      {!! Form::open(['route' => 'posts.store']) !!}
        {!! Form::label('title',"Заголовок:") !!}
        {!! Form::text('title', null, array('class' => 'form-control')) !!}

        {!! Form::label('body', "Текст:") !!}
        {!! Form::textarea('body',null, array('class' => 'form-control')) !!}

        {!! Form::submit('Сохранить', array('class' => 'btn btn-success btn-lg btn-block', 'style' => 'margin-top:10px;')) !!}
      {!! Form::close() !!}
  </div>
</div>
@endsection

我根据 Laravel Collective

处的手册添加了所有需要的行并执行了命令

提供商:

Collective\Html\HtmlServiceProvider::class,

别名:

'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
  1. 首先通过 Composer 安装这个包。编辑项目的 composer.json 文件以要求 laravelcollective/html.

    "require": {
        "laravelcollective/html": "~5.0" 
    }
    
  2. 接下来,从终端更新 Composer。

  3. 接下来,将您的新提供商添加到 config/app.php 的提供商数组中:

    'providers' => [
        'Collective\Html\HtmlServiceProvider'
    ],
    
  4. 最后,在config/app.php的别名数组中添加两个class别名:

    'aliases' => [
        'Form' => 'Collective\Html\FormFacade',
        'Html' => 'Collective\Html\HtmlFacade'
    ],