Laravel 5.1: Class html does not exist

前端 未结 9 2023
一个人的身影
一个人的身影 2020-12-10 04:38

I am upgrading from 4.2 directly to 5.1 and run into problems with the Html and Form classes.

I followed the upgrade notes, and did

  • add \"laravelcollec
相关标签:
9条回答
  • 2020-12-10 05:20

    My problem is solved, but the actual cause is still unknown. I have created a completely new laravel install and copied my source (all of it). The new application worked right away (after installing illuminate/html).

    So you think I did something wrong with packages? That's what I thought, and then I did a diff on the two directories, only to find out they were identical. So it's a real mystery.

    So, now everything is working, I simply renamed my new application and can continue.

    I do know at some point I probably had both the collective and the illuminate versions of the HTML package installed. That's what most likely corrupted everything.

    0 讨论(0)
  • 2020-12-10 05:24

    edit config/app.php

    add this into providers

    Collective\Html\HtmlServiceProvider::class,
    

    and this into aliases

    'Form' => Collective\Html\FormFacade::class,
    'Html' => Collective\Html\HtmlFacade::class,
    
    0 讨论(0)
  • 2020-12-10 05:33

    My solution in my case it was problem with CASE-Sensitive class name.

    In my config/app.php (in aliases)
    'Form'      => Collective\Html\FormFacade::class,
    'Html'      => Collective\Html\HtmlFacade::class,
    

    I am tried to use in view this code:

    {!! HTML::mailto('mailto:example@example.com', 'example@example.com'); !!}
    

    and that was an error:

    "FatalErrorException in ccf70b1d0b9930d6c4e8f3859fff448f line 11: Class 'HTML' not found"
    

    Name of class 'HTML' is CASE-Sensitive. You should use 'Html' as in your config (config/app.php) file.

    Hope this help for some people.

    0 讨论(0)
提交回复
热议问题