Solving the Call to undefined method Illuminate\Foundation\Application::bindShared() Error

Leave a comment

August 6, 2016 by movefirstblog

Whilst following a Laravel CRUD tutorial at https://www.sitepoint.com/crud-create-read-update-delete-laravel-app/ I came across the error:

Call to undefined method Illuminate\Foundation\Application::bindShared()

A quick Google search seemed to suggest that this is a common problem when using the, now deprecated, service provider.

On the Laracasts discussion forum user philsown suggested the following steps to replace the deprecated illuminate/html with the laravelcollective/html package. (This worked perfectly for me).

Use the laravelcollective/html package instead of illuminate/html going forward.

Comment out the references to Illuminate\Html in your config/app.php. (As we’re going to change them in a  minute comment them out rather than removing them).

 

Run composer remove illuminate/html

And then run composer require laravelcollective/html

Uncomment the Illuminate\Html items in your config/app.php file and update references to Collective\Html instead of Illuminate\Html.

Although this worked fine for me philsown suggest that:

you might get an error “Undefined variable: errors (view … path to view). In which case, update your routes.php file to use the new ‘web’ middleware.

Route::group([‘middleware’ => [‘web’]], function () use ($router) { $router->resource(‘whatever’, ‘WhateverController’); });

See https://laracasts.com/discuss/channels/laravel/call-to-undefined-method-illuminatefoundationapplicationbindshared for the original thread.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: