4

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). Add this to composer.json

"require": {
    "laravelcollective/html": "~6.0"
}

2). update composer from the Terminal:

composer update

3). add this to the providers of config/app.php:

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

4). Finally, add two class aliases to the aliases array of config/app.php:

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

Please give advice because it works only with Laravel 5.8.

4

1 回答 1

14

首先安装laravelcollective运行这个composer命令 composer require laravelcollective/html

或从require对象中的作曲家文件

"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 链接的新文档

最后一件事:您不再需要手动包含包提供程序和别名,它将自动添加

于 2019-09-08T06:10:02.693 回答