-
-
Notifications
You must be signed in to change notification settings - Fork 664
Description
Is your feature request related to a problem? Please describe.
I am always a little upset when you need to find and change bread crumbs for several routes. Due to the fact that they are indifferent files and are not related to each other. Therefore, you must first open the file with the routes to see the name of the route, then open another and find a match in it.
// routes/web.php
Route::get('/')->name('home');
Route::get('/about')->name('about');
// routes/breadcrumbs.php
Breadcrumbs::for('home', function ($trail) {
$trail->push('Home');
});
Breadcrumbs::for('about', function ($trail) {
$trail->parent('home');
$trail->push('About');
});
This is not a problem when there are few routes, but when there are many in your application and there are breadcrumbs for everyone, it starts to bother.
Describe the solution you'd like
My suggestion is very simple - combine the announcement of routes and breadcrumbs.
Route::get('/')->name('home')->breadcrumbs(function ($trail) {
$trail->push('Home');
});
Route::get('/about')->name('about')->breadcrumbs(function ($trail) {
$trail->parent('home');
$trail->push('About');
});
As you can see, we have lost the duplicate required parameter name.
Describe alternatives you've considered
Wait until such functionality appears in the dependent package.
Or expect a similar solution in another package dwightwatson/breadcrumbs
Additional context
I added a breadcrumbs
branch with this feature