Laravel 5 And Illuminate/html
I am trying to use {{ HTML }} in my project however I am running into several errors. I researched on internet about the problem, and I believe I am doing the right steps, however,
Solution 1:
Illuminate/HTML package has been deprecated
Use:laravelcollective/html
composer require laravelcollective/html
Add this lines in config/app.php
in providers group:
Collective\Html\HtmlServiceProvider::class,
in aliases group:
'Form' => Collective\Html\FormFacade::class,'Html' => Collective\Html\HtmlFacade::class,
Solution 2:
First the facades aren't correct.
'Form' => 'Illuminate\Html\FormFacade', // FormFacade not HtmlFacade
'Html' => 'Illuminate\Html\HtmlFacade',
The facade is Html
not HTML
.
<!-- This won't work -->
{!! HTML::script('js/jquery.js') !!}
<!-- This should work -->
{!! Html::script('js/jquery.js') !!}
Or you could change the facade key to HTML
and then you can use HTML::script(...)
.
'HTML' => 'Illuminate\Html\HtmlFacade'
Solution 3:
In migrating to 5.1 I found the same issue - it appears as though the HTML class no longer supports the script and style methods.
Instead, use:
{{ URL::asset('yourassetpath') }}
Solution 4:
Try this:
{!! HTML !!}
and, don't forgot to composer dumpautoload
.
See, if that helps.
Solution 5:
you are using two different aliases to the same facade. the correct facades are
'Form' => Illuminate\Support\Facades\Facade\FormFacade::class,'Html' => Illuminate\Support\Facades\Facade\HtmlFacade::class,
this should work
p.s. as of laravel 5.1 you should use facadeName::class
Post a Comment for "Laravel 5 And Illuminate/html"