什么是替代品或Laravel 5.2如何处理HTML和表单


What is the replacement or how does Laravel 5.2 handle HTML and Forms?

Forms and HTML https://laravel.com/docs/4.2/html 在Laravel 5.2中不存在。 什么是替代品或Laravel 5.2如何处理HTML和表单?我检查了文档,它似乎不存在。

如果您愿意,可以重新添加它们

在作曲家中

 require": {
    "illuminate/html"   : "~5.0",

并在您的应用程序提供商中

 'providers' => [
    ...
    'Illuminate'Html'HtmlServiceProvider',
],
'aliases' => [
    ...
    'HTML'      => 'Illuminate'Html'HtmlFacade',
    'Form'      => 'Illuminate'Html'FormFacade',
],

自 5 以来更常见的做法是使用标准 HTML 创建表单并使用请求处理它们

https://laravel.com/docs/5.2/requests#retrieving-input

Illuminate HTML 从 Laravel 5 及更高版本中移除。但是你可以使用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,
        // ...
    ],

有关详细信息,请阅读文档。

Laravel 5.2 用户:

通过运行 composer 进行安装需要 "styde/html=~1.1" 或将 "styde/html": "~1.1" 添加到 composer.json 文件中,然后运行 composer update。

拉维尔 5.1 用户:

通过运行 composer 进行安装需要 "styde/html=~1.0" 或将 "styde/html": "~1.0" 添加到 composer.json 文件中,然后运行 composer update。

接下来,将新提供程序添加到配置/应用程序中的提供程序数组中.php

'providers' => [
    // ...
    Styde'Html'HtmlServiceProvider::class,
    // ...
],

将以下中间件添加到 app/Http/Kernel 中的 $middleware 数组中.php在 EncryptCookies 中间件之前:

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,并带有一些框架预构建的主题。