Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravelcollective/html not working in Laravel 5.5

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() !!}
like image 225
Oluwatoni Adeoye Avatar asked Sep 24 '17 16:09

Oluwatoni Adeoye


2 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() !!}
like image 177
emotality Avatar answered Oct 22 '22 17:10

emotality


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.*"
like image 1
Wisdom Agbenu Avatar answered Oct 22 '22 15:10

Wisdom Agbenu