PHP code example of watson / breadcrumbs

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

    

watson / breadcrumbs example snippets


Breadcrumbs::for('admin.pages.index', function ($trail) {
    $trail->add('Admin', route('admin.pages.index'));
});

Breadcrumbs::for('admin.users.index', function ($trail) {
    $trail->parent('admin.pages.index');
    $trail->add('Users', route('admin.users.index'));
});

Breadcrumbs::for('admin.users.show', function ($trail, User $user) {
    $trail->parent('admin.users.index');
    $trail->add($user->full_name, route('admin.users.show', $user));
});

Breadcrumbs::for('admin.users.edit', function ($trail, User $user) {
    $trail->parent('admin.users.show', $user);
    $trail->add('Edit', route('admin.users.edit', $user));
});

Breadcrumbs::for('admin.users.roles.index', function ($trail, User $user) {
    $trail->parent('admin.users.show', $user);
    $trail->add('Roles', route('admin.users.roles.index', $user));
});

Breadcrumbs::for('admin.users.roles.show', function ($trail, User $user, Role $role) {
    $trail->parent('admin.users.roles.index', $user, $role);
    $trail->add('Edit', route('admin.users.roles.show', [$user, $role]));
});

Breadcrumbs::for('PagesController@getIndex', function ($trail) {
    $trail->add('Home', action('PagesController@getIndex'));
});

Breadcrumbs::for('secret.page', function ($trail) {
    $trail->add('Secret page', url('secret'))
});

{{ Breadcrumbs::render() }}