Class 'HTML' not found (View: C:\xampp\htdocs\laravel_demo\resources\views\pages\registration.blade.php)
Solution 1
The issue is with the capitalization of the class you're trying to use.
If you followed the instructions for the laravelcollective/html
package, you will have added this alias in your config/app.php
file:
'Html' => Collective\Html\HtmlFacade::class,
However, in your blade, you're attempting to use the facade as HTML
. In your blade file, change your line to:
{{ Html::link('http://test.com') }}
Note: Html::
, not HTML::
.
Solution 2
You can try laravel :
URL::route('router_name','parameter_if_require')
Do something like below for Example Here have single_post route and it will take id so i can generate link some thing like below :
<a href="{{ URL::route('single_post', $post->id) }}">View Post</a>
For More check here
And If you want to use direct link then you can use
<a href="{{ URL::to('/your_static_url') }}">Name</a>
Solution 3
Laravel is removing HTML ServiceProvider from built in packages in 5.3, either you install it with LaravelCollectives or use helper functions.
Helper function like url
or routes
, here you have to write you own html.
<a href="{{url('Could be absolute or relative')}}">name</a>
You can read about more helper function here, Laravel Helpers.
Related videos on Youtube
Comments
-
Shanu k k over 1 year
I am beginner in laravel 5.3 and i have added href link to my html form it's get an error like
Class 'HTML' not found (View: C:\xampp\htdocs\laravel_demo\resources\views\pages\registration.blade.php)
I refer the following link for installing forms and Html
My View page:
{{Form::open(array('action' => 'RegistrationController@store', 'method' => 'post'))}} <table> <tr> <td> Entr SNO: </td> <td> {!! Form::text('sno', null, ['class' => 'form-control']) !!} </td> </tr> <tr> <td> Enter Name: </td> <td> {!! Form::text('sname', null, ['class' => 'form-control']) !!} </td> </tr> <tr> <td> Enter Course: </td> <td> {!! Form::text('course', null, ['class' => 'form-control']) !!} </td> </tr> <tr> <td> Entr SNO: </td> <td> {{ Form::select('number', [1, 2, 3], null, ['class' => 'field']) }} </td> </tr> <tr> <td> {!! Form::submit('Submitform', ['class' => 'btn btn-primary']) !!} </td> <td> {{ HTML::link('http://test.com') }} </td> </tr> </table> {!! Form::close() !!}
Form is working well but when i add 'href' link is not working.Please help me
-
kraystackoverflow.com/questions/39639707/… Heres a few answers, should help you out :)
-
-
Binit Ghetiya almost 7 years@Shanukk can you please let me know in config/app.php => do you have this Illuminate\Html\HtmlServiceProvider registered ?
-
Binit Ghetiya almost 7 years@Shanukk updated the answer you can use URL::to also try that.
-
Shanu k k almost 7 yearsOne more doubt I have route
-
Shanu k k almost 7 yearsRoute::resource('registration','RegistrationController'); Route::get('viewDetails','registration@viewDetails'); anything wrong?
-
Binit Ghetiya almost 7 years@Shanukk if it is related to this question then ok else create new question and add in it. and mark this question answer correct if it worked for you thanks :)
-
Shanu k k almost 7 yearsits related to question this is my route,anyway leave it thanks
-
Binit Ghetiya almost 7 yearsLet us continue this discussion in chat.
-
Shanu k k almost 7 yearsthanks this is what i meant...but It shows whole url in view page