Laravel 6:找不到类“表单"
我有一个新的Laravel 6,我尝试使用Laravel表格,但出现错误消息找不到类'Form'".
I have a fresh Laravel 6 and I try to use Laravel forms but I got the error saying "Class 'Form' not found ".
我尝试了以下操作,但仍无法正常工作:
I tried the followings but still not working:
1).将此添加到composer.json
1). Add this to composer.json
"require": {
"laravelcollective/html": "~6.0"
}
2).从终端更新作曲家:
2). update composer from the Terminal:
composer update
3).将此添加到config/app.php的提供程序中:
3). add this to the providers of config/app.php:
'providers' => [
// ...
'Collective\Html\HtmlServiceProvider',
// ...
],
4).最后,将两个类别名添加到config/app.php的aliases数组中:
4). Finally, add two class aliases to the aliases array of config/app.php:
'aliases' => [
// ...
'Form' => 'Collective\Html\FormFacade',
'Html' => 'Collective\Html\HtmlFacade',
// ...
],
请提供建议,因为它仅适用于Laravel 5.8.
Please give advice because it works only with Laravel 5.8.
首先要安装laravelcollective
,请运行此composer命令
composer require laravelcollective/html
First to install laravelcollective
run this composer command
composer require laravelcollective/html
或来自require
对象中的作曲家文件
or from your composer file in the require
object
"require": {
"php": "^7.2",
"fideloper/proxy": "^4.0",
"laravel/framework": "^6.0",
"laravel/tinker": "^1.0",
"laravelcollective/html": "^6.0"
},
它应该是"laravelcollective/html": "^6.0"
而不是"laravelcollective/html": "~6.0"
这是laravel v6.0 的新文档链接
and here is the new docs for laravel v6.0 link
最后一件事:您不再需要手动包含软件包提供程序和别名,它将自动添加
last thing: you don't need any more to include the package providers and aliases manually it will be added automatically