Laravelcollective html 表单错误不起作用

Laravelcollective html form errors are not working

错误:FormBuilder.php 行 1208 中的 BadMethodCallException: 方法 hasErrors 不存在。

所以我像往常一样安装了 Laravelcollective,并且大多数方面都可以正常工作。

我的composer.json

"laravelcollective/html": "~5.0",

并且在我的 config/app.php 提供商中

 Collective\Html\HtmlServiceProvider::class,

还有别名

'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,

但是,我收到错误消息:

第 1208 行 FormBuilder.php 中的 BadMethodCallException: 方法 hasErrors 不存在。

不太确定这里发生了什么。我的 html 错误如下所示。

{{ Form::hasErrors('name') }}
{{ Form::errors('name') }}

我需要为这些安装单独的包吗?

您收到此错误是因为 Laravel Collective 中没有 hasErrors()errors() 方法。我刚刚查看了最新版本包的代码。

请使用此参考 https://laravelcollective.com/docs/5.3/html。在安装包之前它有你需要满足的要求,你也需要先检查它。

结束:

  • 作曲家dump-autoload-o

  • php artisan route:clear

  • php artisan cache:clear

  • 
    
        {!! Form::open(['url' => 'AddDataProfileController']) !!}
          {!!Form::text('email', 'E-Mail Address')!!} 
        {!! Form::close() !!}