laravel-breadcrumbs
Advanced Usage
Macros
{note} laravel-breadcrumbs has been archived and is no longer maintained. Use caution when installing in your apps.
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>