Laravelcollective/html在Laravel 5.5中不起作用 [英] Laravelcollective/html not working in Laravel 5.5

查看:110
本文介绍了Laravelcollective/html在Laravel 5.5中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过在我的composer.json文件中加载v5.4来在laravel 5.5上使用Laravelcollective/html,但这没有用.这是composer.json文件中的代码:

I've tried to use the Laravelcollective/html on laravel 5.5 by loading the v5.4 in my composer.json file but that didn't work. This is the code in the composer.json file:

"laravelcollective/html":"^5.4.0",

并将其加载到我的应用程序配置文件app.php中:providers数组内

and loading it into my app configuration file app.php: inside the providers array

Collective\Html\HtmlServiceProvider::class,

但是在我使用刀片代码创建了无法使用的表单之后,这是刀片代码.

But after i used the blade code to create the form it didn't work, here's the blade code.

{!! Form::open(['route' => 'posts.store']) !!}

{{Form::label('title','Title:')}}

{{Form::text('title', null, array('class' => 'form-control') )}}

{!! Form::close() !!}

推荐答案

通过终端/CMD安装laravelcollective/html:

Install laravelcollective/html via Terminal/CMD:

composer require laravelcollective/html:^5.5.0

app/config/app.php中,添加以下内容:

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

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

在刀片文件中:

{!! Form::open(['route' => 'posts.store']) !!}
{!! Form::label('title', 'Title:') !!}
{!! Form::text('title', null, array('class' => 'form-control')) !!}
{!! Form::close() !!}

这篇关于Laravelcollective/html在Laravel 5.5中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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