Laravel 5 Class 'form' not found

前端 未结 9 772
余生分开走
余生分开走 2020-11-29 02:42

I have added \"illuminate/html\": \"5.*\" to composer.json and ran \"composer update\".

  - Installing illuminate/html (v5.0.0)
    Loading from cache
         


        
9条回答
  •  野性不改
    2020-11-29 03:14

    There is an update to this for Laravel 5.2. Notice this is a slightly different format from what is indicated above.

    Begin by installing this package through Composer. Edit your project's composer.json file to require laravelcollective/html.

    "require": {
        "laravelcollective/html": "5.2.*"
    }
    

    Next, update Composer from the Terminal:

    composer update
    

    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,
        // ...
      ],
    

    After making this update this code worked for me on a new installation of Laravel 5.2:

    {!! Form::open(array('url' => 'foo/bar')) !!}
        //
    {!! Form::close() !!}
    

    I got this information here: https://laravelcollective.com/docs/5.2/html

提交回复
热议问题