Skip to content

drahosistvan/laravel-breadcrumbs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Breadcrumbs package for Laravel

How to install

1. require the package

"drahosistvan/laravel-breadcrumbs": "dev-master"

2. Install

Run composer update command, to install the package.

3. publish

Publish the configuration file with php artisan vendor:publish command

How to use

Controller side:

In your controller, you can add elements to the Breadcrumbs:

//With facade
Breadcrumbs::add('My page', '/page/xy');

//Adding multiple elements to Breadcrumbs
Breadcrumbs::add('My page', '/page/xy')->add('My page', '/page/xy');

If you want a more cleaner way, you can add $breadcrumbs to your base Controller

    protected $breadcrumb;

    public function __construct() {
        $this->breadcrumb = app('Breadcrumbs');
    }

After this, you can add elements like this: $this->breadcrumbs->add()->add() ...

View side:

$breadcrumbs variable is available from the view.

Little trick: If you call $breadcrumbs->last()->title, it will give you the current page's title :)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages