Laravel 5 Class 'HTML' not found

前端 未结 14 1588
野性不改
野性不改 2020-12-10 01:03

I am attempting to use Laravel 5 but my {{ HTML::style(\'style.css\') }} No longer works.

I have updated composer.json to include \"illuminate/ht

14条回答
  •  既然无缘
    2020-12-10 01:27

    1 follow https://laravelcollective.com/docs/5.3/html

    Begin by installing this package through Composer. Run the following from the terminal:

    composer require "laravelcollective/html":"^5.3.0"
    Next, add your new provider to the providers array of config/app.php:
    
      'providers' => [
        // ...
        Collective\Html\HtmlServiceProvider::class,
        // ...
      ],
    

    Finally, add two class aliases to the aliases array of config/app.php:

      'aliases' => [
        // ...
          'Form' => Collective\Html\FormFacade::class,
          'Html' => Collective\Html\HtmlFacade::class,
        // ...
      ],
    

    Now if you want

    {{ HTML::style('css/bootstrap.min.css') }}

    or

    {!! HTML::style('css/bootstrap.min.css') !!}

    //2 way follow.

        {{ HTML::style('css/bootstrap.min.css') }}
    
        //change to 
    
        {{ Html::style('css/bootstrap.min.css') }}
    

    or

        'aliases' => [
                // ...
                  'Form' => Collective\Html\FormFacade::class,
                  'Html' => Collective\Html\HtmlFacade::class,
                // ...
              ],
    
        //change to 
    
        'aliases' => [
                // ...
                  'Form' => Collective\Html\FormFacade::class,
                  'HTML' => Collective\Html\HtmlFacade::class,
                // ...
              ],
    

    for more see this video tutorial..... https://www.youtube.com/watch?v=yl6hkoaCS6g

提交回复
热议问题