FatalErrorException in HtmlServiceProvider.php line 36: laravel

梦想的初衷 提交于 2019-11-29 01:38:21

You need to remove:

'Illuminate\Html\HtmlServiceProvider',

and

'Form'      => 'Illuminate\Html\FormFacade',
'Html'      => 'Illuminate\Html\HtmlFacade',

form your `config/app.php

then remove from your composer.json illuminate/html then add to your composer.json:

"laravelcollective/html": "5.*"

in require section

then run composer install

And further you need to follow instructions for https://laravelcollective.com/docs/5.1/html#installation to complete this package installation

EDIT IT might be not working at this moment because of this: https://github.com/LaravelCollective/html/issues/133 - it will be probably solved after merging this PR: https://github.com/illuminate/html/pull/31/files

favourworks

First, in the composer.json file need to replace:

"illuminate/html": "^5.0"

with

"laravelcollective/html":"5.2.*"

Next you need update the composer from the terminal by typing this command in your terminal: composer update.

Next, in the config/app.php file, you replace the:

'Illuminate\Html\HtmlServiceProvider::class'`

with

'Collective\Html\HtmlServiceProvider::class'

Next you replace these two classes aliases:

'Form'      => Illuminate\Html\FormFacade::class,
'Html'      => Illuminate\Html\HtmlFacade::class, 

with

'Form'      => Collective\Html\FormFacade::class,
'Html'      => Collective\Html\HtmlFacade::class,

Lastly, you need to update your routes.php file by replacing the 'web' middleware with:

Route::group(['middleware' => ['web']], function () use ($router) {
    $router->resource('blogs', 'BlogsController');
});

Here's a tutorial on LaravelCollective.com.

Andrei-Cosmin Pavel

The "trick" that worked for me is the one mentioned above because Illuminate/HTML package has been deprecated:

Use:laravelcollective/html https://stackoverflow.com/a/34991188/3327198

In the terminal (CLI): composer require laravelcollective/html

Add this lines in config/app.php IN PROVIDERS GROUP:

Collective\Html\HtmlServiceProvider::class,

IN ALIASES GROUP: 'Form' => Collective\Html\FormFacade::class, 'Html' => Collective\Html\HtmlFacade::class,

This trick worked for me Change the name of all "bindShared" functions into "singleton" in the vendor\illuminate\html\HtmlServiceProvider.php file

For example: Change

$this->app->bindShared('html', function($app)
{
   return new HtmlBuilder($app['url']);
});

into

$this->app->singleton('html', function($app)
{
   return new HtmlBuilder($app['url']);
});

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!