Basic Usage

Custom Templates

To customize the HTML, create your own view file (e.g. resources/views/partials/breadcrumbs.blade.php), like this:

@if (count($breadcrumbs))

<ol class="breadcrumbs">
    @foreach ($breadcrumbs as $breadcrumb) @if ($breadcrumb->url && !
    <li class="breadcrumb-item">
        <a href="{{ $breadcrumb->url }}">{{ $breadcrumb->title }}</a>
    <li class="breadcrumb-item active">{{ $breadcrumb->title }}</li>
    @endif @endforeach


{tip} See the views/ directory for the built-in templates.

The view will receive an object called $breadcrumbs.

Each breadcrumb is an object with the following keys:

  • title - The breadcrumb title
  • url - The breadcrumb URL, or null if none was given
  • Any additional keys for each item in $data (see Custom Data)

When you create a custom view, you need to update the config/breadcrumbs.php file with the custom view name:

'view' => 'partials.breadcrumbs', #--> resources/views/partials/breadcrumbs.blade.php

Instead of creating your own custom view, you may choose to override one the package's pre-defined templates. You can do so by publishing the views:

php artisan vendor:publish --provider="Rawilk\Breadcrumbs\BreadcrumbsServiceProvider" --tag="views"

This will publish the views to resources/views/vendor/breadcrumbs. From there, you can modify the views to fit your needs.

Defining Breadcrumbs
Caught a mistake? Suggest an edit on GitHub