Laravel 6:找不到类“表单" [英] Laravel 6: Class 'Form' not found

查看:134
本文介绍了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

这篇关于Laravel 6:找不到类“表单"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆