d13r / laravel-breadcrumbs

Please see the Diglactic fork.
https://github.com/diglactic/laravel-breadcrumbs
2.34k stars 416 forks source link

Add breadcrumbs route resource registration. #195

Closed yajra closed 5 years ago

yajra commented 5 years ago

This PR aims to simplify breadcrumbs registration for a Route::resource().

Examples

// web.php
Route::resource('accounts', 'AccountsController');

// breadcrumbs.php
Breadcrumbs::resource('Accounts', 'accounts');

// with parent
Breadcrumbs::resource('Accounts', 'accounts', 'home');

// Override resource breadcrumbs title
Breadcrumbs::resource('Accounts', 'accounts', 'home', 'New Account', 'Edit Account', 'Account Profile');

I already added this in my macros and just submitting a PR incase you like the idea. Thanks!

d13r commented 5 years ago

No, for the same reasons as #171, #63 and possibly others. Namely, it's too specific to the way you want to structure breadcrumbs, not generic enough for everyone to use. For example:

I've yet to see an implementation of Breadcrumbs::resource() that is flexible enough to cover all these variations and is still simpler than just calling Breadcrumbs::for() 4 times - so I suggest sticking with a macro.

Thanks though. Dave