avassilenko / breadcrumbs by crumby

Localized Breadcrumbs for Laravel 5.4
33
0
0
Package Data
Maintainer Username: crumby
Maintainer Contact: avassilenko2@gmail.com (Andrei Vassilenko)
Package Create Date: 2017-08-14
Package Last Update: 2017-09-22
Language: PHP
License: MIT License
Last Refreshed: 2024-12-17 03:06:18
Package Statistics
Total Downloads: 33
Monthly Downloads: 1
Daily Downloads: 0
Total Stars: 0
Total Watchers: 0
Total Forks: 0
Total Open Issues: 0

Installation:

> 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:

  1. add the middleware
    class StaticPagesController extends Controller {
        public function __construct()
        {
            ...........................
            $this->middleware('crumbs');
            ...........................
        }
    }
  1. output breadcrumbs variable in your page body
  {!! $breadcrumbs->render() !!} 

Documentation:

API documentation