Skip to content
Advertisement

diglactic/laravel-breadcrumbs, is there a way to change the parent to custom links?

i used some breadcrumbs that look like this

Breadcrumbs::for('blog', function (BreadcrumbTrail $trail) {
    $trail->parent('home');
    $trail->push('Blog', route('blog'));
});

it work but my app is in somewebsite.com/myapp/

I want to make the parent go to /myapp/ instead of somewebsite.com

is there a way to do that ?

Advertisement

Answer

Project maintainer here, guessing you’ve solved this by now but figured I’d reply all the same.

Breadcrumbs is simply ingesting the output of Laravel’s route('blog') function, which, by default, is an absolute URL. You should be able to pass false as a third parameter to get the output you’re looking for.

$trail->push('Blog', route('blog', [], false));
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement