Class 'HTML' not found (View: C:\xampp\htdocs\laravel_demo\resources\views\pages\registration.blade.php)

Shanu k k picture Shanu k k · Dec 23, 2016 · Viewed 9.7k times · Source

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

Installation

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

Answer

patricus picture patricus · Dec 23, 2016

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::.