Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

1.2K
Visualizações
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.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

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.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda