PHP code example of atstudio-tech / breadcrumbs

1. Go to this page and download the library: Download atstudio-tech/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/ */

    

atstudio-tech / breadcrumbs example snippets


// In your controller
crumbs('Posts', '/posts')->add('Show Post', route('posts.show', $post));

public function show(Post $post)
{
    crumbs('Posts', '/posts')->add($post->title, route('posts.show', $post));
}

Route::get('posts', [PostController::class, 'index'])->crumbs(function (Breadcrumbs $crumbs) {
    $crumbs->add('Posts', '/posts');
});

crumbs('Home', '/')->add('About', '/about');

use Vixen\Breadcrumbs\Facades\Crumbs;

Crumbs::add('Home', '/');

use Vixen\Breadcrumbs\Breadcrumbs;

public function index(Breadcrumbs $crumbs)
{
    $crumbs->add('Home', '/');
}

crumbs([
    'title' => 'Posts',
    'path' => '/posts',
    'extra' => ['icon' => 'newspaper'],
]);

// Home > [Electronics | Clothing | Books] > Product Name
crumbs('Home', '/')
    ->add([
        ['title' => 'Electronics', 'path' => '/categories/electronics'],
        ['title' => 'Clothing', 'path' => '/categories/clothing'],
        ['title' => 'Books', 'path' => '/categories/books'],
    ])
    ->add($product->name, route('products.show', $product));

crumbs()->render('breadcrumbs::custom-view')
shell
php artisan vendor:publish --tag="breadcrumbs-config"
php artisan vendor:publish --tag="breadcrumbs-views"