"drahosistvan/laravel-breadcrumbs": "dev-master"
Run composer update
command, to install the package.
Publish the configuration file with php artisan vendor:publish
command
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() ...
$breadcrumbs
variable is available from the view.
Little trick:
If you call $breadcrumbs->last()->title
, it will give you the current page's title :)