Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

1.2K
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda