crumby / breadcrumbs
Localized Breadcrumbs for Laravel 5.4
1.0.0
2017-08-20 05:52 UTC
Requires
- php: >=5.6.0
- crumby/route-locale: 1.0.*@dev
This package is not auto-updated.
Last update: 2024-12-08 03:36:18 UTC
README
> composer require crumby/breadcrumbs
> php artisan vendor:publish --provider="Crumby\Breadcrumbs\BreadcrumbsServiceProvider" --tag=config
> php artisan vendor:publish --provider="Crumby\Breadcrumbs\BreadcrumbsServiceProvider" --tag=lang
Register service and facade:
File: config/app.php
'providers' => [
......................
'Crumby\Breadcrumbs\BreadcrumbsServiceProvider',
........................
];
'aliases' => [
......................
'Breadcrumbs' => 'Crumby\Breadcrumbs\Facades\Breadcrumbs',
......................
];
Configuration:
- Automatic Breadcrumbs generation config/crumby-crumbs/route-breadcrumbs.php
<?php
return [
'routes' => [
'package' => [
'childOf' => [
'route' => 'packages'
]
],
'article' => [
'childOf' => [
'route' => 'package'
]
],
]
];
- 'label' key can be used to resolve the Breadcrumb display name for route static url.
- If there is(are) dynamic parameter(s) in url, RouteResolver should be configured.
Example:
- add the middleware
class StaticPagesController extends Controller {
public function __construct()
{
...........................
$this->middleware('crumbs');
...........................
}
}
- output breadcrumbs variable in your page body
{!! $breadcrumbs->render() !!}