2017 © Pedro Peláez
 

library breadcrumbs

Easy breadcrumb generation

image

kkiernan/breadcrumbs

Easy breadcrumb generation

  • Wednesday, February 15, 2017
  • by kkiernan
  • Repository
  • 1 Watchers
  • 1 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Easy Breadcrumb Generation

, (*1)

Install

First, install the package via composer:, (*2)

composer require kkiernan/breadcrumbs

If using Laravel, add the service provider and alias to config/app.php., (*3)

'providers' => [
    Kiernan\Breadcrumbs\ServiceProvider::class,
],

'aliases' => [
    'Breadcrumbs' => \Kiernan\Breadcrumbs\Facade::class,
]

Usage

Add breadcrumbs as needed before rendering your view:, (*4)

Breadcrumbs::add('Posts', action('PostsController@index'));
Breadcrumbs::add('New Post');

Add many breadcrumbs at once if you prefer:, (*5)

Breadcrumbs::addMany([
    ['Posts', action('PostsController@index')],
    ['New Post']
]);

A Bootstrap partial is included to display your breadcrumbs. If using Laravel Blade, you can include the partial in your template:, (*6)

@include('kkiernan::breadcrumbs');

If you'd like to edit the partial, publish it to resources/views/vendor/kkiernan:, (*7)

php artisan vendor:publish --tag=kkiernan

Dynamic Crumbs

Breadcrumbs can be added dynamically, which is helpful when multiple pages link to a particular page. For example, imagine that both a dashboard and a list of posts link to a post detail view. Consider the following Laravel-centric example in which the first breadcrumb will render as either "Dashboard" or "Posts" depending on the referring page., (*8)

// DashboardController@index...
Breadcrumbs::put('posts', 'Dashboard', action('DashboardController@index'));
// PostsController@index...
Breadcrumbs::put('posts', 'Posts', action('DashboardController@index'));
// PostsController@show...
Breadcrumbs::addDynamic('posts');
Breadcrumbs::add($post->title);

If you need to unset a dynamic crumb and prevent it from rendering, simply call the forget method:, (*9)

Breadcrumbs::forget('posts');

The Versions

15/02 2017

dev-master

9999999-dev

Easy breadcrumb generation

  Sources   Download

MIT

The Requires

 

by Kelly Kiernan

15/02 2017

0.1.1

0.1.1.0

Easy breadcrumb generation

  Sources   Download

MIT

by Kelly Kiernan

09/02 2017

0.1.0

0.1.0.0

Easy breadcrumb generation

  Sources   Download

MIT

by Kelly Kiernan