diglactic / laravel-breadcrumbs

Laravel Breadcrumbs - A simple Laravel-style way to create breadcrumbs.
https://packagist.org/packages/diglactic/laravel-breadcrumbs
MIT License
868 stars 63 forks source link

Translations #50

Closed precamp-io closed 2 years ago

precamp-io commented 2 years ago

Thanks for building such and amazing addition. I am using translation in my project like this {{__('Projects')}} how would this be incorporated so that breadcrumbs can take translations into consideration? {{ Breadcrumbs::render() }}

Breadcrumbs::for('projects.index', function (BreadcrumbTrail $trail): void { $trail->push('Projects', route('projects.index')); });

shengslogar commented 2 years ago

__ is the name of a function. You can inject that into Breadcrumbs (or anywhere else in your Laravel project) like this:

Breadcrumbs::for('projects.index', function (BreadcrumbTrail $trail): void {
     $trail->push(__('Projects'), route('projects.index'));
});