diglactic / laravel-breadcrumbs

Laravel Breadcrumbs - A simple Laravel-style way to create breadcrumbs.
https://packagist.org/packages/diglactic/laravel-breadcrumbs
MIT License
868 stars 63 forks source link

Static invocation possible? #6

Closed fbc closed 4 years ago

fbc commented 4 years ago

With tabuna/breadcrumbs you can just use in a blade template partial:

@if(Breadcrumbs::has())
    @foreach (Breadcrumbs::current() as $crumbs)
        @if ($crumbs->url() && !$loop->last)
            <li class="breadcrumb-item">
                <a href="{{ $crumbs->url() }}">
                    {{ $crumbs->title() }}
                </a>
            </li>
        @else
            <li class="breadcrumb-item active">
                {{ $crumbs->title() }}
            </li>
        @endif
    @endforeach
@endif

and there is no need to visit each blade file to paste anything in. Would it be too difficult to adopt this approach? I love this package and all the great work your put into it, and it's still a time saver. I just wish it could save you an extra step.

shengslogar commented 4 years ago

Not sure I follow. You can configure your template by modifying the view config value, and assuming you name your breadcrumbs the same as your routes, can render breadcrumbs by calling Breadcrumbs::render() anywhere. How is what you’re suggesting different?

fbc commented 4 years ago

@shengslogar Thanks.. I didn't realize that it would dynamically look for the path.