Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Pineco.de:
Lightweight Breadcrumbs in Laravel
Apr 25, 2018 @ 12:10:15

On the Pineco.de site they've posted a tutorial showing how to create a lightweight breadcrumb system for use in a Laravel application. It makes use of a "view composer" to help translate the current path into a matching "crumb".

Breadcrumbs are important in web applications. But most of the time, it’s not the easiest to track the different levels in your URL and generate breadcrumbs from it. Now we give it a try with a simple yet elegant solution.

The post starts by describing the basic concept and the article that inspired their finished product. They needed a dynamic solution that could translate the URL to a breadcrumb list. They created an array with a crumb-to-URL relationship and made use of Laravel's view composer handling to create the collection of crumbs from the current request information. Finally they include the partial view that can be used to render the results, looping through them and outputting each as a link.

tagged: breadcrumb tutorial laravel viewcomposer template

Link: https://pineco.de/lightweight-breadcrumbs-in-laravel/