我有分组面包屑的问题。以下是我的代码:
Breadcrumbs::register('front', function($breadcrumbs) {
$breadcrumbs->push('Home', URL::to('/'));
});
Breadcrumbs::group(['prefix' => 'front', 'parent' => 'front'], function($breadcrumbs)
{
Breadcrumbs::register('product', function($breadcrumbs) {
$breadcrumbs->push(trans('front.product'), route('product'));
});
});
发生错误:
中的FatalErrorException /project/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php 第219行:调用未定义的方法 DaveJamesMiller \面包屑\管理::组()
我正在尝试使用breadcrumb,如下例所示,但没有运气: https://github.com/davejamesmiller/laravel-breadcrumbs/issues/84
答案 0 :(得分:0)
快速面包屑,不要忘记创建优化代码的布局。 的 @include( 'page.breadcrumbs')强>
<nav class="breadcrumb" style="font-size: 18px;">
<?php $breadcrumb = ''?>
@for($i = 0; $i <= count(Request::segments()); $i++)
<?php $breadcrumb .= Request::segment($i).'/'; ?>
@if($i == 1)
<a class="breadcrumb-item" href="{{url($breadcrumb).'/inicio'}}">{{Request::segment($i).' / '}}</a>
@elseif($i == count(Request::segments()))
<a class="breadcrumb-item active" href="{{url($breadcrumb)}}">{{Request::segment($i)}}</a>
@else
<a class="breadcrumb-item" href="{{url($breadcrumb)}}">{{Request::segment($i).' / '}}</a>
@endif
@endfor
</nav>