Laravel 5.2-添加laravelcollective/html/5.2会引发错误


Laravel 5.2 - Adding laravelcollective/html 5.2 throws errors

我使用的是Laravel v5.2,并按照下面的说明安装了laravelcollective.html,但它仍然会抛出错误:

Browser:ProviderRepository.php中的FatalErrorException第119行:调用未定义的方法Collective''Html''FormFacade::isDeferred()

Artisan:[Symfony''Component''Debug''Exception''FatalErrorException]调用未定义的方法Collective''Html''FormFacade::isDeferred()

也尝试了5.2.*-dev,但得到了相同的错误。

希望有人能帮忙!

命令:

composer require laravelcollective/html

添加到composer.json"require"组:

"laravelcollective/html": "5.2.*"
composer update

添加到提供者组的config/app.php中:

Collective'Html'HtmlServiceProvider::class,

在别名组中:

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

我希望现在还为时不晚,但也许你的问题的答案会对未来的参考有用。因此,这里是一步一步:

1) 在您的laravel包的根目录中,"require"组中的open composer.json文件应该添加以下行:

"laravelcollective/html": "5.2.*"

它应该类似于:"要求":{"php":">=5.5.9","laravel/framework":"5.2.","laravelcollective.html":"5.2."},

2) 打开命令提示符或Git Bash并使用以下命令更新composer:

composer update

作曲家将在大约一两分钟内更新。

3) 打开config/app.php,在提供者组中添加此行:

Collective'Html'HtmlServiceProvider::class,

别忘了用逗号分隔上一个类。它应该看起来像:

Illuminate'Validation'ValidationServiceProvider::class,
Illuminate'View'ViewServiceProvider::class,
Collective'Html'HtmlServiceProvider::class,

4) 在别名组的同一文件中添加以下别名:

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

所以它应该看起来像:

'View' => Illuminate'Support'Facades'View::class,
'Form' => Collective'Html'FormFacade::class,
'Html' => Collective'Html'HtmlFacade::class,

我希望这将有助于任何使用Laravel 5.2的人。*