ホーム > Laravel > Implementing Breadcrumbs in Laravel with laravel-breadcrumbs
Laravel

Implementing Breadcrumbs in Laravel with laravel-breadcrumbs

Thank you for your continued support.
This article contains advertisements that help fund our operations.

Using the package called laravel-breadcrumbs, we will implement breadcrumbs in Laravel.

What are Breadcrumbs?

Breadcrumbs Image

Breadcrumbs are designed to help users navigate a website easily by showing their current location, such as Home ➡ Category ➡ Product.

The origin of the name "breadcrumbs" comes from the story of Hansel and Gretel, where the siblings left breadcrumbs in the forest to find their way back.

Lear more here

Laravel provides a package that makes it relatively easy to create breadcrumbs, and I would like to explain how to use it in this article.

Check out the Table of Contents of Laravel articles here

Environment

MacOS Laravel6 "diglactic/laravel-breadcrumbs": "^6.1",

Installing the Breadcrumbs Package

composer require diglactic/laravel-breadcrumbs

Package documentation

Creating the Breadcrumbs Definition File

Create the file in the same folder as web.php or api.php.

routes/breadcrumbs.php

Add content like this:

<?php
// Home
Breadcrumbs::for('home', function ($trail) {
    $trail->push('Home', route('home'));
});

The rest of the article has been translated into English.

Please Provide Feedback
We would appreciate your feedback on this article. Feel free to leave a comment on any relevant YouTube video or reach out through the contact form. Thank you!