Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

1.2K
Views
Call to undefined method Illuminate\Foundation\Application::share() when use breadcrumbs package

Today, I want to use Laravel Breadcrumbs package with laravel 5.4. I used that with laravel 5.3 without any problem and all things worked fine.

But when run the application I got this error :

FatalErrorException in ServiceProvider.php line 34:
Call to undefined method Illuminate\Foundation\Application::share()

I searched for that and I found that As of laravel 5.4 share has been removed. and I must to use the singleton instead.

But when I did that changes In the ServiceProvider.php like this :

public function register()
    {
        $this->app['breadcrumbs'] = $this->app->singleton(function($app)
        {
            $breadcrumbs = $this->app->make('DaveJamesMiller\Breadcrumbs\Manager');

            $viewPath = __DIR__ . '/../views/';

            $this->loadViewsFrom($viewPath, 'breadcrumbs');
            $this->loadViewsFrom($viewPath, 'laravel-breadcrumbs'); // Backwards-compatibility with 2.x

            $breadcrumbs->setView($app['config']['breadcrumbs.view']);

            return $breadcrumbs;
        });
    }

I got another error. like this :

ErrorException in Container.php line 1057:
Illegal offset type in unset

I do not know what is problem. can anyone help me ?

Update :

I found the solution Here.

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The first problem is that the singleton instance expects a class to bind to as the first argument, which in this case is 'breadcrumbs'.

The second problem is that you don't need to explicitly declare the array key for the singleton instance. So this is how it should look:

$this->app->singleton('breadcrumbs', function($app)

The next problem is that the package you're using has been abandoned. The developer will no longer maintain it.

The final problem is that you're using a version < 3.0.2. So change the version in your composer.json to 3.0.2 and then install that, then you shouldn't need to be modifying any files.

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!