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

10.6k views Asked by At

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

5

There are 5 answers

1
patricus On BEST ANSWER

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

8
Binit Ghetiya On

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>

0
anwerj On

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.

0
Priyank lohan On

<a href="{{'presentation_page'}}/{{$latest_file_uploads->id}}" class="title" title = "{{$latest_file_uploads->file_name}}" >

try like this it will work great

0
Sunil kumawat On

Its html package error...so install HTML package and then move following steps. process(1)

step(1) Go -> composer.json-> "require":{ .... "laravelcollective/html": "~5.0"

step(2) cmd
      C:\xampp\htdocs\any_project file> composer update
step(3) app.php-config
     add folloewing these statement.
     -> 'provider' => [ Collective\Html\HtmlServiceProvider::class, ]
     ->'aliases'   => [ 'Html' => Collective\Html\HtmlFacade::class,
                       'Form' => Collective\Html\FormFacade::class,]

process(2)

step(1) Go -> composer.json-> "require":{ .... "illuminate/html":"5.*"

step(2)

cmd
          C:\xampp\htdocs\any_project file> composer update
    step(3) app.php-config
         add folloewing these statement.
         -> 'provider' => [ Illiminate\Html\HtmlSeviceProvider::class, ]
         ->'aliases'   => [ 'Html' => Illuminate\Html\HtmlFacade::class,]