Breadcrumb Component

For understanding, how the component work, please refer to alert components

php artisan make:component breadcrumbsComponent

I get the below code from StackOverflow which creates breadcrumb dynamically. View

<div id="breadcrumbs"> <a href="/">Home</a> > <?php $link = "" ?> @for($i = 1; $i <= count(Request::segments()); $i++) @if($i < count(Request::segments()) & $i > 0) <?php $link .= "/" . Request::segment($i); ?> <a href="<?= $link ?>">{{ ucwords(str_replace('-',' ',Request::segment($i)))}}</a> > @else {{ucwords(str_replace('-',' ',Request::segment($i)))}} @endif @endfor </div>

Nothing is change in breadcrumbComponent class file