Laravel 5.2中不存在表单和HTML https://laravel.com/docs/4.2/html。什么是替换或Laravel 5.2如何处理HTML和表单?我检查了文档,似乎不存在。
答案 0 :(得分:1)
如果您愿意,可以添加它们
在Composer中
require": {
"illuminate/html" : "~5.0",
并在你的app providors
'providers' => [
...
'Illuminate\Html\HtmlServiceProvider',
],
'aliases' => [
...
'HTML' => 'Illuminate\Html\HtmlFacade',
'Form' => 'Illuminate\Html\FormFacade',
],
更常见的做法是从5开始使用标准html创建表单并使用请求处理它们
答案 1 :(得分:1)
从Laravel 5及更高版本中删除了Illuminate HTML。但是你可以使用Laravel Collective。
将这些行添加到composer.json
文件中:
"require": {
"laravelcollective/html": "5.2.*"
}
运行composer update
接下来,将新的提供程序添加到config / app.php的提供程序数组中:
'providers' => [
// ...
Collective\Html\HtmlServiceProvider::class,
// ...
],
最后,将两个类别名添加到config / app.php的别名数组中:
'aliases' => [
// ...
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
// ...
],
更多阅读Documentation。
答案 2 :(得分:1)
Laravel 5.2用户:
通过运行composer require" styde / html = ~1.1"进行安装或添加" styde / html":" ~1.1"到你的composer.json文件,然后运行composer update。
Laravel 5.1用户:
通过运行composer require" styde / html = ~1.0"进行安装或者添加" styde / html":" ~1.0"到你的composer.json文件,然后运行composer update。
接下来,将新提供程序添加到config / app.php
中的providers数组中'providers' => [
// ...
Styde\Html\HtmlServiceProvider::class,
// ...
],
在EncryptCookies中间件之前,将以下中间件添加到app / Http / Kernel.php中的$ middleware数组中:
protected $middleware = [
//...
\Styde\Html\Alert\Middleware::class,
//...
];
每个请求完成后,需要使用此中间件在会话之间保持警报消息的持久性。
请注意,以下全局别名将自动可用(您不需要添加它们):
Alert => Styde\Html\Facades\Alert
Field => Styde\Html\Facades\Field
Menu => Styde\Html\Facades\Menu
Form => Collective\Html\FormFacade
Html => Collective\Html\HtmlFacade
If you plan to use the Access Handler as a standalone class, you will need to add the following alias:
'aliases' => [
// ...
'Access' => Styde\Html\Facades\Access::class,
// ...
],
或者,您也可以运行$php artisan vendor:publish --provider='Styde\Html\HtmlServiceProvider'
在config / html.php中发布配置文件并查看其选项和值。
它扩展了Laravel Collective,并附带了一些预构建主题的框架。