diglactic / laravel-breadcrumbs

Laravel Breadcrumbs - A simple Laravel-style way to create breadcrumbs.
https://packagist.org/packages/diglactic/laravel-breadcrumbs
MIT License
868 stars 63 forks source link

Throw exception for recursive parent Breadcrumb reference #21

Closed emilas44 closed 3 years ago

emilas44 commented 3 years ago

Let's say someone makes a mistake and instead of this:

Breadcrumbs::for('users.index', function ($trail) {
    $trail->parent('dashboard');
    $trail->push('Users', route('users.index'));
});

writes this:

Breadcrumbs::for('users.index', function ($trail) {
    $trail->parent('users.index');
    $trail->push('Users', route('users.index'));
});

Can you please throw some error on this.... so that you actually prevent setting the parent to the same thing.

shengslogar commented 3 years ago

Hmm... I'll take a look at some point. Feel free to open a PR if you want to add this yourself. Not at the top of my priority list right now.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.