user860511
user860511

Reputation:

DaveJamesMiller Breadcrumbs Error - Laravel

I am currently trying to set up breadcrumbs for my Laravel 5 application. Unfortunately, I am currently being presented with this error when I access localhost:8888/auth/login:

ErrorException in /Users/ben/Sites/laravel/vendor/davejamesmiller/laravel-breadcrumbs/src/CurrentRoute.php line 29

The current route (GET /auth/login) is not named - please check routes.php for an "as" parameter

Routes.php:

Route::get('auth/login', 'Auth\AuthController@getLogin',
['as' => 'login', 'uses' => 'Auth/AuthController@getLogin']);

The error is shown with or without the ['as' => 'login', 'uses' => 'Auth/AuthController@getLogin'] addition.

Breadcrumbs.php

Breadcrumbs::register('login', function($breadcrumbs)
{
    $breadcrumbs->parent('home');
    $breadcrumbs->push('Login', route('login'));
});

Thank you for your help.

Upvotes: 1

Views: 2769

Answers (1)

user860511
user860511

Reputation:

I resolved this issue by changing the route to the following:

Route::get('auth/login',
    ['as' => 'login', 'uses' => 'Auth/AuthController@getLogin']);

You can only declare which controller method you're using once.

Upvotes: 1

Related Questions