Laravelcollective/html not working in Laravel 5.5

自闭症网瘾萝莉.ら 提交于 2019-12-04 10:47:39

In composer.json, add:

"require": {
    // ...,
     "laravelcollective/html": "^5.4.0"
    // ...,
 },

In app/config/app.php, add the following to each array:

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

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

And in your blade file:

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

Then run $ composer require laravelcollective/html:^5.4.0 after adding the above. :)

Wisdom Agbenu

You can use this command

composer require --update-with-all-dependencies "laravelcollective/html 5.6.*"... since you are using laravel 5.5 the command to use will be 
composer require "laravelcollective/html 5.5.*"

You also have to add the following to your alias array:

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

],

The syntax you are using is old style.

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

It needs to be

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

You can do it in laravel 5.5 too. Step 1: Install from Command: composer require "laravelcollective/html":"^5.5"

Step 2: After install you have to add providers and aliases in config/app.php file, so let' follow bellow file how to add.

Step 2.1:

<?php

'providers' => [

    // ...

    Collective\Html\HtmlServiceProvider::class,

    // ...

  ],

'aliases' => [

    // ...

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

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

    // ...

  ],

Step 3: After added above providers, you have to check on your project.

Step 4: Done.

Thanks.

it Simple use this one:

composer require laravelcollective/html
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!