laravel-breadcrumbs
Advanced Usage
Macros
{note} laravel-breadcrumbs has been archived and is no longer maintained. Use caution when installing in your apps.
{note} You're browsing the documentation for an old version of laravel-breadcrumbs. Consider upgrading your project to v4. Check your version with the following command:
`composer show rawilk/laravel-breadcrumbs`
The Breadcrumbs instance is macroable, so you can add your own methods. For example:
use Rawilk\Breadcrumbs\Facades\Breadcrumbs;
Breadcrumbs::macro('pageTitle', function () {
$title = ($breadcrumb = $this->current()) ? "{$breadcrumb->title} - " : '';
if (($page = (int) request('page')) > 1) {
$title .= "Page {$page} - ";
}
return $title . 'Acme';
});
<title>{!! Breadcrumbs::pageTitle() !!}</title>