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

Issue

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 ?

Solution

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));

Answered By – Sheng Slogar

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published