Laravelcollective/html not working in Laravel 5.5

Viewed 8493

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",

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() !!}
6 Answers

Install laravelcollective/html via Terminal/CMD:

composer require laravelcollective/html:^5.5.0

In app/config/app.php, add the following:

'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() !!}

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:') !!}

it Simple use this one:

composer require laravelcollective/html
Related