d13r/laravel-breadcrumbs

ErrorException in breadcrumbs.php line 12: Missing argument 2 for DaveJamesMiller\Breadcrumbs\ServiceProvider::{closure}()

mborges-ptc opened this issue · 1 comments

When try access 'retailer/{retailer}/users' page, the next exception is throw:

ErrorException in breadcrumbs.php line 12: Missing argument 2 for DaveJamesMiller\Breadcrumbs\ServiceProvider::{closure}()
in breadcrumbs.php line 12
at HandleExceptions->handleError('2', 'Missing argument 2 for DaveJamesMiller\Breadcrumbs\ServiceProvider::{closure}()', '/home/vagrant/Code/ppp/app/Http/breadcrumbs.php', '12', array('breadcrumbs' => object(Generator))) in breadcrumbs.php line 12
at ServiceProvider->{closure}(object(Generator))
at call_user_func_array(object(Closure), array(object(Generator))) in Generator.php line 25
at Generator->call('app.retailer.show', array()) in Generator.php line 32
at Generator->parent('app.retailer.show') in breadcrumbs.php line 18
at ServiceProvider->{closure}(object(Generator), object(Retailer))
at call_user_func_array(object(Closure), array(object(Generator), object(Retailer))) in Generator.php line 25
at Generator->call('app.retailer.users.index', array(object(Retailer))) in Generator.php line 13
at Generator->generate(array('app.home' => object(Closure), 'app.retailer.index' => object(Closure), 'app.retailer.show' => object(Closure), 'app.retailer.users.index' => object(Closure)), 'app.retailer.users.index', array(object(Retailer))) in Manager.php line 45
at Manager->generate() in Facade.php line 213
at Facade::__callStatic('generate', array()) in RetailerUserController.php line 38
at Facade::generate() in RetailerUserController.php line 38
at RetailerUserController->index(object(Retailer))
at call_user_func_array(array(object(RetailerUserController), 'index'), array('retailer' => object(Retailer))) in Controller.php line 256
at Controller->callAction('index', array('retailer' => object(Retailer))) in ControllerDispatcher.php line 164
at ControllerDispatcher->call(object(RetailerUserController), object(Route), 'index') in ControllerDispatcher.php line 112
at ControllerDispatcher->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in ControllerDispatcher.php line 114
at ControllerDispatcher->callWithinStack(object(RetailerUserController), object(Route), object(Request), 'index') in ControllerDispatcher.php line 69
at ControllerDispatcher->dispatch(object(Route), object(Request), 'App\Http\Controllers\Webapp\Retailer\RetailerUserController', 'index') in Route.php line 203
at Route->runWithCustomDispatcher(object(Request)) in Route.php line 134
at Route->run(object(Request)) in Router.php line 708
at Router->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Authenticate.php line 45
at Authenticate->handle(object(Request), object(Closure))
at call_user_func_array(array(object(Authenticate), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Theme.php line 28
at Theme->handle(object(Request), object(Closure), 'porto')
at call_user_func_array(array(object(Theme), 'handle'), array(object(Request), object(Closure), 'porto')) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Router.php line 710
at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 675
at Router->dispatchToRoute(object(Request)) in Router.php line 635
at Router->dispatch(object(Request)) in Kernel.php line 236
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Debugbar.php line 49
at Debugbar->handle(object(Request), object(Closure))
at call_user_func_array(array(object(Debugbar), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in NotificationMiddleware.php line 58
at NotificationMiddleware->handle(object(Request), object(Closure))
at call_user_func_array(array(object(NotificationMiddleware), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in VerifyCsrfToken.php line 50
at VerifyCsrfToken->handle(object(Request), object(Closure))
at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in ShareErrorsFromSession.php line 49
at ShareErrorsFromSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in StartSession.php line 62
at StartSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))
at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in EncryptCookies.php line 59
at EncryptCookies->handle(object(Request), object(Closure))
at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in CheckForMaintenanceMode.php line 44
at CheckForMaintenanceMode->handle(object(Request), object(Closure))
at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Kernel.php line 122
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 87
at Kernel->handle(object(Request)) in index.php line 54

My Routes:

+-------------+----------+------------------------------------------+-------------------------------+---------------------------------------------------------------------+-------------------+
| Domain      | Method   | URI                                      | Name                          | Action                                                              | Middleware        |
+-------------+----------+------------------------------------------+-------------------------------+---------------------------------------------------------------------+-------------------+
| app.ppp.dev | GET|HEAD | /                                        | app.home                      | App\Http\Controllers\Webapp\DashboardController@showDashboard       | theme:porto,auth  |
| app.ppp.dev | GET|HEAD | retailer                                 | app.retailer.index            | App\Http\Controllers\Webapp\Retailer\RetailerController@index       | theme:porto,auth  |
| app.ppp.dev | GET|HEAD | retailer/{retailer}                      | app.retailer.show             | App\Http\Controllers\Webapp\Retailer\RetailerController@show        | theme:porto,auth  |
| app.ppp.dev | POST     | retailer/{retailer}/users                | app.retailer.users.store      | App\Http\Controllers\Webapp\Retailer\RetailerUserController@store   | theme:porto,auth  |
| app.ppp.dev | GET|HEAD | retailer/{retailer}/users                | app.retailer.users.index      | App\Http\Controllers\Webapp\Retailer\RetailerUserController@index   | theme:porto,auth  |
| app.ppp.dev | GET|HEAD | retailer/{retailer}/users/{user}/admin   | app.retailer.users.make-admin | App\Http\Controllers\Webapp\Retailer\RetailerUserController@admin   | theme:porto,auth  |
| app.ppp.dev | GET|HEAD | retailer/{retailer}/users/{user}/block   | app.retailer.users.block      | App\Http\Controllers\Webapp\Retailer\RetailerUserController@block   | theme:porto,auth  |
| app.ppp.dev | GET|HEAD | retailer/{retailer}/users/{user}/unblock | app.retailer.users.unblock    | App\Http\Controllers\Webapp\Retailer\RetailerUserController@unblock | theme:porto,auth  |
+-------------+----------+------------------------------------------+-------------------------------+---------------------------------------------------------------------+-------------------+

My Breadcrumbs:

<?php

Breadcrumbs::register('app.home', function ($breadcrumbs) {
    $breadcrumbs->push('Início', route('app.home'), ['icon' => 'home']);
});

Breadcrumbs::register('app.retailer.index', function ($breadcrumbs) {
    $breadcrumbs->parent('app.home');
    $breadcrumbs->push('As Minhas Lojas', route('app.retailer.index'));
});

Breadcrumbs::register('app.retailer.show', function ($breadcrumbs, $retailer) {
    $breadcrumbs->parent('app.retailer.index');
    $breadcrumbs->push($retailer->name, route('app.retailer.show', $retailer->slug));
});

Breadcrumbs::register('app.retailer.users.index', function ($breadcrumbs, $retailer) {
    $breadcrumbs->parent('app.retailer.show');
    $breadcrumbs->push('Utilizadores', route('app.retailer.users.index', $retailer->slug));
});

Model binding:

        $router->bind('retailer', function ($value) {
            return Retailer::whereSlug($value)->first();
        });
d13r commented

You're missing the $retailer parameter in this line:

$breadcrumbs->parent('app.retailer.show');