PHP code example of robotsinside / laravel-breadcrumbs

1. Go to this page and download the library: Download robotsinside/laravel-breadcrumbs library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

robotsinside / laravel-breadcrumbs example snippets


/*
* Package Service Providers...
*/
\RobotsInside\Breadcrumbs\BreadcrumbsServiceProvider::class,

    'aliases' => [
        ...
        'Breadcrumbs' => \RobotsInside\Breadcrumbs\Facades\Breadcrumbs::class,
    ],

<div class="container">
    {{ Breadcrumbs::render() }}
</div>



namespace App\Breadcrumbs\Labels;

use RobotsInside\Breadcrumbs\Label;

class PostBreadcrumbLabel extends Label
{
    public function label()
    {
        return $this->model->whatever;
    }    
}

'template' => [
    'style' => 'custom',
    'path' => 'breadcrumbs.custom' // Will look in: 'views.breadcrumbs.custom'
],

'modelAttributes' => [
    'name', 
    'title',
    'whatever'
]

'labels' => [
    App\Post::class => App\Breadcrumbs\Labels\PostBreadcrumbLabel::class,
],



namespace App\Breadcrumbs\Mutators;

use RobotsInside\Breadcrumbs\Mutator;

class AdminMutator extends Mutator
{
	public function mutate()
	{
		$this->remove(['admin']);
	}
}



namespace App\Breadcrumbs\Mutators;

use RobotsInside\Breadcrumbs\Mutator;

class AddPostIndexMutator extends Mutator
{
	public function mutate()
	{
		$this->add('All Posts', 'my-post', route('posts.index'));
	}
}