LaravelPackages.net
Acme Inc.
Toggle sidebar
drahosistvan/laravel-breadcrumbs

Simple breadcrumbs service for Laravel.

238
0
v1.0.0
About drahosistvan/laravel-breadcrumbs

drahosistvan/laravel-breadcrumbs is a Laravel package for simple breadcrumbs service for laravel.. It currently has 0 GitHub stars and 238 downloads on Packagist (latest version v1.0.0). Install it with composer require drahosistvan/laravel-breadcrumbs. Discover more Laravel packages by drahosistvan or browse all Laravel packages to compare alternatives.

Last updated

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

Comments