在我的路线的某个地方遇到了问题。 Laravel

问题描述 投票:0回答:2

在Laravel工作。我在那里遇到了一个问题。错误消息:找不到类“表单”

我的路线:

Route::get('/h', function () {
return view('Account.hb');
});
Route::get('/h',['uses'=>'AccountController@manageCategory']);
Route::post('/h',['as'=>'add.category','uses'=>'AccountController@addCategory']);

在我的模板中:

{!! Form::open(['route'=>'add.category']) !!}

谢谢。

php laravel
2个回答
2
投票

你有没有为你的项目添加laravelcollective / html?如果不使用此命令添加它:

composer require "laravelcollective/html":"^5.4.0"

然后将此行添加到providers部分中的config / app.php文件中:

Collective\Html\HtmlServiceProvider::class,

并将这些行添加到别名部分中的同一文件中:

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

有关更多信息,请访问this link


1
投票

新的laravel没有Form Collective的包。所以在安装时你做不到

{! Form :: open(['route'=>'add.category'])!!}

如果项目已存在且您在本地运行,请确保运行composer install以安装依赖项(如果它包含在composer包中)。

要么

你可以在https://laravelcollective.com/docs/5.4/html中按照这个步骤

你很高兴。

© www.soinside.com 2019 - 2024. All rights reserved.