Tips and Tricks

How to create breadcrumbs in Laravel


In this article, you will learn how to show breadcrumbs on your web application.

This short example is made primarily for Laravel CMS, but you could apply this idea to any web project.

The trick is to simply grab a part of your current page’s URL and show it nicely somewhere at the top of your page.

	<?php $current_route = request()->route()->getName();
	$breadcrumb = str_replace('.',' / ',$current_route);
	$breadcrumb = ucwords($breadcrumb);