Please see the Diglactic fork.

Overview

Update: 18 October 2020

There is now an official fork of Laravel Breadcrumbs:
https://github.com/diglactic/laravel-breadcrumbs

Blog post:
https://newsroom.diglactic.com/laravel-breadcrumbs/

Thanks to Sheng Slogar of Diglactic for volunteering to take this project forward.

Dave


As of 18 April 2020, Laravel Breadcrumbs is not being maintained.

It will probably keep working for a while - I removed the version constraint from composer.json, so it will keep working until a future version of Laravel makes breaking changes.

If you want to create your own fork, to fix bugs or add new features, please see the instructions below. The MIT license requires you to keep the copyright notice and license information, but otherwise you can do what you like with the code and documentation.

Thanks to the contributors who helped maintain it and add features over the last 7 years - I just don't have the energy for maintaining open source projects (or writing blog posts, or for social media) that I did in 2013, and I've decided it's time to focus on new projects instead.

Dave



Laravel Breadcrumbs

Latest Stable Version Total Downloads Monthly Downloads License
Latest Unstable Version Build Status Coverage Status

A simple Laravel-style way to create breadcrumbs.

Table of Contents

Compatibility Chart

Laravel Breadcrumbs Laravel PHP
5.3.2 5.6+ 7.1+
5.3.0 – 5.3.1 5.6 – 6.x 7.1+
5.2.1 5.6 – 5.8 7.1+
5.1.1 – 5.2.0 5.6 – 5.7 7.1+
5.0.0 – 5.1.0 5.6 7.1+
4.x 5.5 7.0+
3.x 5.0 – 5.4 5.4+
2.x 4.0 – 4.2 5.3+

Getting Started

Note: If you are using an older version, click it in the table above to see the documentation for that version.

Note 2: If you think this documentation can be improved in any way, please edit this file and make a pull request.

1. Install Laravel Breadcrumbs

Run this at the command line:

composer require davejamesmiller/laravel-breadcrumbs:5.x

This will update composer.json and install the package into the vendor/ directory.

2. Define your breadcrumbs

Create a file called routes/breadcrumbs.php that looks like this:

<?php

// Home
Breadcrumbs::for('home', function ($trail) {
    $trail->push('Home', route('home'));
});

// Home > About
Breadcrumbs::for('about', function ($trail) {
    $trail->parent('home');
    $trail->push('About', route('about'));
});

// Home > Blog
Breadcrumbs::for('blog', function ($trail) {
    $trail->parent('home');
    $trail->push('Blog', route('blog'));
});

// Home > Blog > [Category]
Breadcrumbs::for('category', function ($trail, $category) {
    $trail->parent('blog');
    $trail->push($category->title, route('category', $category->id));
});

// Home > Blog > [Category] > [Post]
Breadcrumbs::for('post', function ($trail, $post) {
    $trail->parent('category', $post->category);
    $trail->push($post->title, route('post', $post->id));
});

See the Defining Breadcrumbs section for more details.

3. Choose a template

By default a Bootstrap-compatible ordered list will be rendered, so if you're using Bootstrap 4 you can skip this step.

First initialise the config file by running this command:

php artisan vendor:publish --tag=breadcrumbs-config

Then open config/breadcrumbs.php and edit this line:

    'view' => 'breadcrumbs::bootstrap4',

The possible values are:

See the Custom Templates section for more details.

4. Output the breadcrumbs

Finally, call Breadcrumbs::render() in the view for each page, passing it the name of the breadcrumb to use and any additional parameters – for example:

{{ Breadcrumbs::render('home') }}

{{ Breadcrumbs::render('category', $category) }}

See the Outputting Breadcrumbs section for other output options, and see Route-Bound Breadcrumbs for a way to link breadcrumb names to route names automatically.

Defining Breadcrumbs

Breadcrumbs will usually correspond to actions or types of page. For each breadcrumb you specify a name, the breadcrumb title and the URL to link it to. Since these are likely to change dynamically, you do this in a closure, and you pass any variables you need into the closure.

The following examples should make it clear:

Static pages

The most simple breadcrumb is probably going to be your homepage, which will look something like this:

Breadcrumbs::for('home', function ($trail) {
     $trail->push('Home', route('home'));
});

As you can see, you simply call $trail->push($title, $url) inside the closure.

For generating the URL, you can use any of the standard Laravel URL-generation methods, including:

  • url('path/to/route') (URL::to())
  • secure_url('path/to/route')
  • route('routename') or route('routename', 'param') or route('routename', ['param1', 'param2']) (URL::route())
  • action('controller@action') (URL::action())
  • Or just pass a string URL ('http://www.example.com/')

This example would be rendered like this:

{{ Breadcrumbs::render('home') }}

And results in this output:

Home

Parent links

This is another static page, but this has a parent link before it:

Breadcrumbs::for('blog', function ($trail) {
    $trail->parent('home');
    $trail->push('Blog', route('blog'));
});

It works by calling the closure for the home breadcrumb defined above.

It would be rendered like this:

{{ Breadcrumbs::render('blog') }}

And results in this output:

Home / Blog

Note that the default templates do not create a link for the last breadcrumb (the one for the current page), even when a URL is specified. You can override this by creating your own template – see Custom Templates for more details.

Dynamic titles and links

This is a dynamically generated page pulled from the database:

Breadcrumbs::for('post', function ($trail, $post) {
    $trail->parent('blog');
    $trail->push($post->title, route('post', $post));
});

The $post object (probably an Eloquent model, but could be anything) would simply be passed in from the view:

{{ Breadcrumbs::render('post', $post) }}

It results in this output:

Home / Blog / Post Title

Tip: You can pass multiple parameters if necessary.

Nested categories

Finally, if you have nested categories or other special requirements, you can call $trail->push() multiple times:

Breadcrumbs::for('category', function ($trail, $category) {
    $trail->parent('blog');

    foreach ($category->ancestors as $ancestor) {
        $trail->push($ancestor->title, route('category', $ancestor->id));
    }

    $trail->push($category->title, route('category', $category->id));
});

Alternatively you could make a recursive function such as this:

Breadcrumbs::for('category', function ($trail, $category) {
    if ($category->parent) {
        $trail->parent('category', $category->parent);
    } else {
        $trail->parent('blog');
    }

    $trail->push($category->title, route('category', $category->slug));
});

Both would be rendered like this:

{{ Breadcrumbs::render('category', $category) }}

And result in this:

Home / Blog / Grandparent Category / Parent Category / Category Title

Custom Templates

Create a view

To customise the HTML, create your own view file (e.g. resources/views/partials/breadcrumbs.blade.php) like this:

@if (count($breadcrumbs))

    <ol class="breadcrumb">
        @foreach ($breadcrumbs as $breadcrumb)

            @if ($breadcrumb->url && !$loop->last)
                <li class="breadcrumb-item"><a href="{{ $breadcrumb->url }}">{{ $breadcrumb->title }}</a></li>
            @else
                <li class="breadcrumb-item active">{{ $breadcrumb->title }}</li>
            @endif

        @endforeach
    </ol>

@endif

(See the views/ directory for the built-in templates.)

View data

The view will receive an array called $breadcrumbs.

Each breadcrumb is an object with the following keys:

  • title – The breadcrumb title
  • url – The breadcrumb URL, or null if none was given
  • Plus additional keys for each item in $data (see Custom data)

Update the config

Then update your config file (config/breadcrumbs.php) with the custom view name, e.g.:

    'view' => 'partials.breadcrumbs', #--> resources/views/partials/breadcrumbs.blade.php

Skipping the view

Alternatively you can skip the custom view and call Breadcrumbs::generate() to get the breadcrumbs Collection directly:

@foreach (Breadcrumbs::generate('post', $post) as $breadcrumb)
    {{-- ... --}}
@endforeach

Outputting Breadcrumbs

Call Breadcrumbs::render() in the view for each page, passing it the name of the breadcrumb to use and any additional parameters.

With Blade

In the page (e.g. resources/views/home.blade.php):

{{ Breadcrumbs::render('home') }}

Or with a parameter:

{{ Breadcrumbs::render('category', $category) }}

With Blade layouts and @section

In the page (e.g. resources/views/home.blade.php):

@extends('layout.name')

@section('breadcrumbs')
    {{ Breadcrumbs::render('home') }}
@endsection

Or using the shorthand syntax:

@extends('layout.name')

@section('breadcrumbs', Breadcrumbs::render('home'))

And in the layout (e.g. resources/views/layout/name.blade.php):

@yield('breadcrumbs')

Pure PHP (without Blade)

In the page (e.g. resources/views/home.php):

<?= Breadcrumbs::render('home') ?>

Or use the longhand syntax if you prefer:

<?php echo Breadcrumbs::render('home') ?>

Structured Data

To render breadcrumbs as JSON-LD structured data (usually for SEO reasons), use Breadcrumbs::view() to render the breadcrumbs::json-ld template in addition to the normal one. For example:

<html>
    <head>
        ...
        {{ Breadcrumbs::view('breadcrumbs::json-ld', 'category', $category) }}
        ...
    </head>
    <body>
        ...
        {{ Breadcrumbs::render('category', $category) }}
        ...
    </body>
</html>

(Note: If you use Laravel Page Speed you may need to disable the TrimUrls middleware.)

To specify an image, add it to the $data parameter in push():

Breadcrumbs::for('post', function ($trail, $post) {
    $trail->parent('home');
    $trail->push($post->title, route('post', $post), ['image' => asset($post->image)]);
});

(If you prefer to use Microdata or RDFa you will need to create a custom template.)

Route-Bound Breadcrumbs

In normal usage you must call Breadcrumbs::render($name, $params...) to render the breadcrumbs on every page. If you prefer, you can name your breadcrumbs the same as your routes and avoid this duplication...

Name your routes

Make sure each of your routes has a name. For example (routes/web.php):

// Home
Route::name('home')->get('/', 'HomeController@index');

// Home > [Post]
Route::name('post')->get('/post/{id}', 'PostController@show');

For more details see Named Routes in the Laravel documentation.

Name your breadcrumbs to match

For each route, create a breadcrumb with the same name and parameters. For example (routes/breadcrumbs.php):

// Home
Breadcrumbs::for('home', function ($trail) {
     $trail->push('Home', route('home'));
});

// Home > [Post]
Breadcrumbs::for('post', function ($trail, $id) {
    $post = Post::findOrFail($id);
    $trail->parent('home');
    $trail->push($post->title, route('post', $post));
});

To add breadcrumbs to a custom 404 Not Found page, use the name errors.404:

// Error 404
Breadcrumbs::for('errors.404', function ($trail) {
    $trail->parent('home');
    $trail->push('Page Not Found');
});

Output breadcrumbs in your layout

Call Breadcrumbs::render() with no parameters in your layout file (e.g. resources/views/app.blade.php):

{{ Breadcrumbs::render() }}

This will automatically output breadcrumbs corresponding to the current route. The same applies to Breadcrumbs::generate():

$breadcrumbs = Breadcrumbs::generate();

And to Breadcrumbs::view():

{{ Breadcrumbs::view('breadcrumbs::json-ld') }}

Route binding exceptions

It will throw an InvalidBreadcrumbException if the breadcrumb doesn't exist, to remind you to create one. To disable this (e.g. if you have some pages with no breadcrumbs), first initialise the config file, if you haven't already:

php artisan vendor:publish --tag=breadcrumbs-config

Then open config/breadcrumbs.php and set this value:

    'missing-route-bound-breadcrumb-exception' => false,

Similarly, to prevent it throwing an UnnamedRouteException if the current route doesn't have a name, set this value:

    'unnamed-route-exception' => false,

Route model binding

Laravel Breadcrumbs uses the same model binding as the controller. For example:

// routes/web.php
Route::name('post')->get('/post/{post}', 'PostController@show');
// app/Http/Controllers/PostController.php
use App\Post;

class PostController extends Controller
{
    public function show(Post $post) // <-- Implicit model binding happens here
    {
        return view('post/show', ['post' => $post]);
    }
}
// routes/breadcrumbs.php
Breadcrumbs::for('post', function ($trail, $post) { // <-- The same Post model is injected here
    $trail->parent('home');
    $trail->push($post->title, route('post', $post));
});

This makes your code less verbose and more efficient by only loading the post from the database once.

For more details see Route Model Binding in the Laravel documentation.

Resourceful controllers

Laravel automatically creates route names for resourceful controllers, e.g. photo.index, which you can use when defining your breadcrumbs. For example:

// routes/web.php
Route::resource('photo', PhotoController::class);
$ php artisan route:list
+--------+----------+--------------------+---------------+-------------------------+------------+
| Domain | Method   | URI                | Name          | Action                  | Middleware |
+--------+----------+--------------------+---------------+-------------------------+------------+
|        | GET|HEAD | photo              | photo.index   | PhotoController@index   |            |
|        | GET|HEAD | photo/create       | photo.create  | PhotoController@create  |            |
|        | POST     | photo              | photo.store   | PhotoController@store   |            |
|        | GET|HEAD | photo/{photo}      | photo.show    | PhotoController@show    |            |
|        | GET|HEAD | photo/{photo}/edit | photo.edit    | PhotoController@edit    |            |
|        | PUT      | photo/{photo}      | photo.update  | PhotoController@update  |            |
|        | PATCH    | photo/{photo}      |               | PhotoController@update  |            |
|        | DELETE   | photo/{photo}      | photo.destroy | PhotoController@destroy |            |
+--------+----------+--------------------+---------------+-------------------------+------------+
// routes/breadcrumbs.php

// Photos
Breadcrumbs::for('photo.index', function ($trail) {
    $trail->parent('home');
    $trail->push('Photos', route('photo.index'));
});

// Photos > Upload Photo
Breadcrumbs::for('photo.create', function ($trail) {
    $trail->parent('photo.index');
    $trail->push('Upload Photo', route('photo.create'));
});

// Photos > [Photo Name]
Breadcrumbs::for('photo.show', function ($trail, $photo) {
    $trail->parent('photo.index');
    $trail->push($photo->title, route('photo.show', $photo->id));
});

// Photos > [Photo Name] > Edit Photo
Breadcrumbs::for('photo.edit', function ($trail, $photo) {
    $trail->parent('photo.show', $photo);
    $trail->push('Edit Photo', route('photo.edit', $photo->id));
});

For more details see Resource Controllers in the Laravel documentation.

(Related FAQ: Why is there no Breadcrumbs::resource() method?.)

Advanced Usage

Breadcrumbs with no URL

The second parameter to push() is optional, so if you want a breadcrumb with no URL you can do so:

$trail->push('Sample');

The $breadcrumb->url value will be null.

The default Bootstrap templates provided render this with a CSS class of "active", the same as the last breadcrumb, because otherwise they default to black text not grey which doesn't look right.

Custom data

The push() method accepts an optional third parameter, $data – an array of arbitrary data to be passed to the breadcrumb, which you can use in your custom template. For example, if you wanted each breadcrumb to have an icon, you could do:

$trail->push('Home', '/', ['icon' => 'home.png']);

The $data array's entries will be merged into the breadcrumb as properties, so you would access the icon as $breadcrumb->icon in your template, like this:

<li><a href="{{ $breadcrumb->url }}">
    <img src="/images/icons/{{ $breadcrumb->icon }}">
    {{ $breadcrumb->title }}
</a></li>

Do not use the keys title or url as they will be overwritten.

Before and after callbacks

You can register "before" and "after" callbacks to add breadcrumbs at the start/end of the trail. For example, to automatically add the current page number at the end:

Breadcrumbs::after(function ($trail) {
    $page = (int) request('page', 1);
    if ($page > 1) {
        $trail->push("Page $page");
    }
});

Getting the current page breadcrumb

To get the last breadcrumb for the current page, use Breadcrumb::current(). For example, you could use this to output the current page title:

<title>{{ ($breadcrumb = Breadcrumbs::current()) ? $breadcrumb->title : 'Fallback Title' }}</title>

To ignore a breadcrumb, add 'current' => false to the $data parameter in push(). This can be useful to ignore pagination breadcrumbs:

Breadcrumbs::after(function ($trail) {
    $page = (int) request('page', 1);
    if ($page > 1) {
        $trail->push("Page $page", null, ['current' => false]);
    }
});
<title>
    {{ ($breadcrumb = Breadcrumbs::current()) ? "$breadcrumb->title" : '' }}
    {{ ($page = (int) request('page')) > 1 ? "Page $page" : '' }}
    Demo App
</title>

For more advanced filtering, use Breadcrumbs::generate() and Laravel's Collection class methods instead:

$current = Breadcrumbs::generate()->where('current', '!==', 'false)->last();

Switching views at runtime

You can use Breadcrumbs::view() in place of Breadcrumbs::render() to render a template other than the default one:

{{ Breadcrumbs::view('partials.breadcrumbs2', 'category', $category) }}

Or you can override the config setting to affect all future render() calls:

Config::set('breadcrumbs.view', 'partials.breadcrumbs2');
{{ Breadcrumbs::render('category', $category) }}

Or you could call Breadcrumbs::generate() to get the breadcrumbs Collection and load the view manually:

@include('partials.breadcrumbs2', ['breadcrumbs' => Breadcrumbs::generate('category', $category)])

Overriding the "current" route

If you call Breadcrumbs::render() or Breadcrumbs::generate() with no parameters, it will use the current route name and parameters by default (as returned by Laravel's Route::current() method).

You can override this by calling Breadcrumbs::setCurrentRoute($name, $param1, $param2...).

Checking if a breadcrumb exists

To check if a breadcrumb with a given name exists, call Breadcrumbs::exists('name'), which returns a boolean.

Defining breadcrumbs in a different file

If you don't want to use routes/breadcrumbs.php, you can change it in the config file. First initialise the config file, if you haven't already:

php artisan vendor:publish --tag=breadcrumbs-config

Then open config/breadcrumbs.php and edit this line:

    'files' => base_path('routes/breadcrumbs.php'),

It can be an absolute path, as above, or an array:

    'files' => [
        base_path('breadcrumbs/admin.php'),
        base_path('breadcrumbs/frontend.php'),
    ],

So you can use glob() to automatically find files using a wildcard:

    'files' => glob(base_path('breadcrumbs/*.php')),

Or return an empty array [] to disable loading.

Defining/using breadcrumbs in another package

If you are creating your own package, simply load your breadcrumbs file from your service provider's boot() method:

use Illuminate\Support\ServiceProvider;

class MyServiceProvider extends ServiceProvider
{
    public function register() {}

    public function boot()
    {
        if (class_exists('Breadcrumbs')) {
            require __DIR__ . '/breadcrumbs.php';
        }
    }
}

Dependency injection

You can use dependency injection to access the BreadcrumbsManager instance if you prefer, instead of using the Breadcrumbs:: facade:

use DaveJamesMiller\Breadcrumbs\BreadcrumbsManager;
use Illuminate\Support\ServiceProvider;

class MyServiceProvider extends ServiceProvider
{
    public function register() {}

    public function boot(BreadcrumbsManager $breadcrumbs)
    {
        $breadcrumbs->register(...);
    }
}

Macros

The BreadcrumbsManager class is macroable, so you can add your own methods. For example:

Breadcrumbs::macro('pageTitle', function () {
    $title = ($breadcrumb = Breadcrumbs::current()) ? "{$breadcrumb->title} – " : '';

    if (($page = (int) request('page')) > 1) {
        $title .= "Page $page – ";
    }

    return $title . 'Demo App';
});
<title>{{ Breadcrumbs::pageTitle() }}</title>

Advanced customisations

For more advanced customisations you can subclass BreadcrumbsManager and/or BreadcrumbsGenerator, then update the config file with the new class name:

    // Manager
    'manager-class' => DaveJamesMiller\Breadcrumbs\BreadcrumbsManager::class,

    // Generator
    'generator-class' => DaveJamesMiller\Breadcrumbs\BreadcrumbsGenerator::class,

(Note: Anything that's not part of the public API (see below) may change between releases, so I suggest you write unit tests to ensure it doesn't break when upgrading.)

API Reference

Breadcrumbs Facade

Method Returns Added in
Breadcrumbs::for(string $name, closure $callback) void 5.1.0
Breadcrumbs::register(string $name, closure $callback) void 1.0.0
Breadcrumbs::before(closure $callback) void 4.0.0
Breadcrumbs::after(closure $callback) void 4.0.0
Breadcrumbs::exists() boolean 2.2.0
Breadcrumbs::exists(string $name) boolean 2.2.0
Breadcrumbs::generate() Collection 2.2.3
Breadcrumbs::generate(string $name) Collection 1.0.0
Breadcrumbs::generate(string $name, mixed $param1, ...) Collection 1.0.0
Breadcrumbs::render() string 2.2.0
Breadcrumbs::render(string $name) string 1.0.0
Breadcrumbs::render(string $name, mixed $param1, ...) string 1.0.0
Breadcrumbs::view(string $view) string 4.0.0
Breadcrumbs::view(string $view, string $name) string 4.0.0
Breadcrumbs::view(string $view, string $name, mixed $param1, ...) string 4.0.0
Breadcrumbs::setCurrentRoute(string $name) void 2.2.0
Breadcrumbs::setCurrentRoute(string $name, mixed $param1, ...) void 2.2.0
Breadcrumbs::clearCurrentRoute() void 2.2.0

Source

Defining breadcrumbs

use App\Models\Post;
use DaveJamesMiller\Breadcrumbs\BreadcrumbsGenerator;

Breadcrumbs::before(function (BreadcrumbsGenerator $trail) {
    // ...
});

Breadcrumbs::for('name', function (BreadcrumbsGenerator $trail, Post $post) {
    // ...
});

Breadcrumbs::after(function (BreadcrumbsGenerator $trail) {
    // ...
});
Method Returns Added in
$trail->push(string $title) void 1.0.0
$trail->push(string $title, string $url) void 1.0.0
$trail->push(string $title, string $url, array $data) void 2.3.0
$trail->parent(string $name) void 1.0.0
$trail->parent(string $name, mixed $param1, ...) void 1.0.0

Source

In the view (template)

@foreach ($breadcrumbs as $breadcrumb)
    {{-- ... --}}
@endforeach
Variable Type Added in
$breadcrumb->title string 1.0.0
$breadcrumb->url string / null 1.0.0
$breadcrumb->custom_attribute_name mixed 2.3.0

Source

Configuration file

config/breadcrumbs.php

Setting Type Added in
view string 2.0.0
files string / array 4.0.0
unnamed-route-exception boolean 4.0.0
missing-route-bound-breadcrumb-exception boolean 4.0.0
invalid-named-breadcrumb-exception boolean 4.0.0
manager-class string 4.2.0
generator-class string 4.2.0

Source

FAQ

There's a new version of Laravel - can you add support for it?

Since version 5.3.2, there is no maximum version of Laravel specified in composer.json, so most of the time it will just work.

If it breaks for any reason, it will be fixed when (1) someone submits a pull request to fix it, or (2) I decide to upgrade my own applications - whichever comes first. In practice it's usually the former because I don't generally upgrade on day 1.

Why is there no Breadcrumbs::resource() method?

A few people have suggested adding Breadcrumbs::resource() to match Route::resource(), but no-one has come up with a good implementation that (a) is flexible enough to deal with translations, nested resources, etc., and (b) isn't overly complex as a result.

Personally I don't think there is a good all-round solution, so instead I recommend adding your own using Breadcrumbs::macro(). Here's a starting point:

Breadcrumbs::macro('resource', function ($name, $title) {
    // Home > Blog
    Breadcrumbs::for("$name.index", function ($trail) use ($name, $title) {
        $trail->parent('home');
        $trail->push($title, route("$name.index"));
    });

    // Home > Blog > New
    Breadcrumbs::for("$name.create", function ($trail) use ($name) {
        $trail->parent("$name.index");
        $trail->push('New', route("$name.create"));
    });

    // Home > Blog > Post 123
    Breadcrumbs::for("$name.show", function ($trail, $model) use ($name) {
        $trail->parent("$name.index");
        $trail->push($model->title, route("$name.show", $model));
    });

    // Home > Blog > Post 123 > Edit
    Breadcrumbs::for("$name.edit", function ($trail, $model) use ($name) {
        $trail->parent("$name.show", $model);
        $trail->push('Edit', route("$name.edit", $model));
    });
});

Breadcrumbs::resource('blog', 'Blog');
Breadcrumbs::resource('photos', 'Photos');
Breadcrumbs::resource('users', 'Users');

Note that this doesn't deal with translations or nested resources, and it assumes that all models have a title attribute (which users probably don't). Adapt it however you see fit.

Troubleshooting

General

  • Re-read the instructions and make sure you did everything correctly.
  • Start with the simple options and only use the advanced options (e.g. Route-Bound Breadcrumbs) once you understand how it works.

Class 'Breadcrumbs' not found

  • Try running composer update davejamesmiller/laravel-breadcrumbs to upgrade.
  • Try running php artisan package:discover to ensure the service provider is detected by Laravel.

Breadcrumb not found with name ...

  • Make sure you register the breadcrumbs in the right place (routes/breadcrumbs.php by default).
    • Try putting dd(__FILE__) in the file to make sure it's loaded.
    • Try putting dd($files) in BreadcrumbsServiceProvider::registerBreadcrumbs() to check the path is correct.
    • If not, try running php artisan config:clear (or manually delete bootstrap/cache/config.php) or update the path in config/breadcrumbs.php.
  • Make sure the breadcrumb name is correct.
    • If using Route-Bound Breadcrumbs, make sure it matches the route name exactly.
  • To suppress these errors when using Route-Bound Breadcrumbs (if you don't want breadcrumbs on some pages), either:

BreadcrumbsServiceProvider::registerBreadcrumbs(): Failed opening required ...

  • Make sure the path is correct.
  • If so, check the file ownership & permissions are correct.
  • If not, try running php artisan config:clear (or manually delete bootstrap/cache/config.php) or update the path in config/breadcrumbs.php.

Undefined variable: breadcrumbs

  • Make sure you use {{ Breadcrumbs::render() }} or {{ Breadcrumbs::view() }}, not @include().

Method for does not exist

  • You're probably using a version older than 5.1 - use Breadcrumbs::register() instead of Breadcrumbs::for() (or upgrade).

Something else

Sorry I wasn't able to help this time, but once you have solved your problem, please edit this file with the solution to help the next person!

Contributing

Documentation: If you think the documentation can be improved in any way, please do edit this file and make a pull request.

Bug fixes: Please fix it and open a pull request. (See below for more detailed instructions.) Bonus points if you add a unit test to make sure it doesn't happen again!

New features: Only features with a clear use case and well-considered API will be accepted. They must be documented and include unit tests. If in doubt, make a proof-of-concept (either code or documentation) and open a pull request to discuss the details. (Tip: If you want a feature that's too specific to be included by default, see Macros or Advanced customisations for ways to add them.)

Creating a pull request

The easiest way to work on Laravel Breadcrumbs is to tell Composer to install it from source (Git) using the --prefer-source flag:

rm -rf vendor/davejamesmiller/laravel-breadcrumbs
composer install --prefer-source

Then checkout the master branch and create your own local branch to work on:

cd vendor/davejamesmiller/laravel-breadcrumbs
git checkout -t origin/master
git checkout -b YOUR_BRANCH

Now make your changes, including unit tests and documentation (if appropriate). Run the unit tests to make sure everything is still working:

scripts/test.sh

Then commit the changes. Fork the repository on GitHub if you haven't already, and push your changes to it:

git remote add YOUR_USERNAME [email protected]:YOUR_USERNAME/laravel-breadcrumbs.git
git push -u YOUR_USERNAME YOUR_BRANCH

Finally, browse to the repository on GitHub and create a pull request.

(Alternatively, there is a test app that you can use.)

Using your fork in a project

To use your own fork in a project, update the composer.json in your main project as follows:

{
    // ADD THIS:
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/YOUR_USERNAME/laravel-breadcrumbs.git"
        }
    ],
    "require": {
        // UPDATE THIS:
        "davejamesmiller/laravel-breadcrumbs": "dev-YOUR_BRANCH"
    }
}

Replace YOUR_USERNAME with your GitHub username and YOUR_BRANCH with the branch name (e.g. develop). This tells Composer to use your repository instead of the default one.

Unit tests

To run the unit tests:

scripts/test.sh

To check code coverage:

scripts/test-coverage.sh

Then open test-coverage/index.html to view the results. Be aware of the edge cases in PHPUnit that can make it not-quite-accurate.

New version of Laravel

There is no maximum version specified in composer.json, so there is no need for a new version of Laravel Breadcrumbs to be released every 6 months. However, this file will need to be updated to run tests against the new version:

  • .travis.yml
    • matrix (Laravel versions)
    • php (PHP versions)
    • exclude (Unsupported combinations)

If changes are required, also update:

If backwards-incompatible changes cause the minimum supported versions of Laravel or PHP to change, update:

Releasing a new version

This section is for maintainers only.

  • Ensure the unit tests are updated and have 100% coverage
  • Update the test app, if appropriate, and test it manually
  • Ensure the README is up to date, including:
  • Merge the changes into the master branch (if necessary)
  • Push the code changes to GitHub (git push)
  • Make sure all tests are passing
  • Tag the release (git tag 1.2.3)
  • Push the tag (git push --tag)

No Technical Support

Sorry, I don't offer any technical support, and GitHub Issues are disabled. That means I won't figure out why it's not working for you, I won't fix bugs for you, and I won't write new features on request - this is free software after all.

But the beauty of open source is you can do whatever you want with it! You can fork it, fix it, improve it and extend it. If you don't want to maintain your own fork, and you think other people would benefit from your changes, you can submit a pull request to have your changes included in the next release.

If you get really stuck, I suggest you:

  1. Read and re-read both this file and the Laravel documentation to see if you missed something.
  2. Dive into the source code and spend some time figuring out how it's meant to work and what's actually happening.
  3. Try to reproduce the problem on a brand new Laravel project, in case it's an incompatibility with another package or your other code.
  4. Ask your colleagues to help you debug it, if you work in a team.
  5. Pay someone more experienced to help you (or if you work for a company, ask your boss to pay them).
  6. Try posting on Stack Overflow, Laravel.io Forum or Laracasts Forum (but I can't promise anyone will answer - they don't get paid either).
  7. Use a different package instead.
  8. Write your own.

Changelog

Laravel Breadcrumbs uses Semantic Versioning.

v5.3.2 (Mon 30 Dec 2019)

  • Remove the maximum Laravel version constraint from composer.json, to support Laravel 7+ without requiring a new release every 6 months

v5.3.1 (Sun 20 Oct 2019)

v5.3.0 (Tue 3 Sep 2019)

  • Add Laravel 6.x support
  • Add Laravel Ignition suggested solutions
  • Change vendor:publish tag from config to breadcrumbs-config to match Horizon & Telescope and simplify the command

v5.2.1 (Wed 27 Feb 2019)

v5.2.0 (Tue 30 Oct 2018)

v5.1.2 (Fri 14 Sep 2018)

v5.1.1 (Wed 5 Sep 2018)

  • Add Laravel 5.7 support

v5.1.0 (Sat 5 May 2018)

  • Add Breadcrumbs::for($name, $callback) as an alias for Breadcrumbs::register($name, $callback)
  • Renamed $breadcrumbs to $trail in documentation (this doesn't affect the code)

These changes were inspired by (read: taken directly from) Dwight Watson's Breadcrumbs package.

Upgrading from 5.0.0 to 5.1.0

No changes are required, but I recommend updating your routes/breadcrumbs.php to match the new documentation:

  • Replace Breadcrumbs::register with Breadcrumbs::for
  • Replace $breadcrumbs with $trail

v5.0.0 (Sat 10 Feb 2018)

  • Add Laravel 5.6 support, and drop support for Laravel 5.5
  • Drop PHP 7.0 support (add void return type hint, and use [] instead of list())
  • Fix class names in PhpDoc for Breadcrumbs facade when using IDE Helper

Upgrading from 4.x to 5.x

  • Upgrade to Laravel 5.6 (requires PHP 7.1.3+)
  • If you are extending any classes, add : void return type hints where needed.

Older versions

License

MIT License

Copyright © 2013-2019 Dave James Miller

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Comments
  • Added support for Laravel 4.2

    Added support for Laravel 4.2

    I changed Illuminate\View\Environment to Illuminate\View\Factory, changed the variable name from $environment to $factory and bumped the Mockery dependency to ~0.9.0, cause PHPUnit 4.0 was throwing errors for 0.8. Because Laravel 4.2 is PHP 5.4 and up only I also removed the PHP 5.3 tests from .travis.yml.

    opened by boris-glumpler 16
  • THIS PACKAGE IS NO LONGER MAINTAINED

    THIS PACKAGE IS NO LONGER MAINTAINED

    Laravel Breadcrumbs is no longer officially maintained Please see the README file for further details.


    Feel free to use this issue to discuss possible forks among yourselves, but I please be aware I will not receive any notifications.

    opened by d13r 14
  • can't get post category

    can't get post category

    Hi, I have some trouble to get post category in my breadcrumbs. I defined breadcrumbs like this:

    // Home Breadcrumbs::for('home', function ($trail) { $trail->push('Home', route('home')); });

    // Home > [Category] Breadcrumbs::for('category', function ($trail, $category) { $trail->parent('home'); $trail->push($category->title, route('category', $category->slug)); });

    // Home > [Category] > [Post] Breadcrumbs::for('post', function ($trail, $post) { $trail->parent('category', $post->category); $trail->push($post->title, route('post', $post->slug)); });

    and in my post view template: {{ Breadcrumbs::render( 'post', $post ) }}

    but getting this error on post view: Undefined property: stdClass::$category

    and this refers to this line of defined breadcrumb: $trail->parent('category', $post->category);

    my posts table does not have category column! what should i pass as the second parameter of parent method? and should i pass post's category row to my post view?

    opened by ehsanmusavi 12
  • FQN in documentation

    FQN in documentation

    Laravel usually has FQN in documentation. Example in Laravel Framework: https://github.com/laravel/framework/blob/bd352a0d2ca93775fce8ef02365b03fc4fb8cbb0/src/Illuminate/Auth/Access/HandlesAuthorization.php (there is FQN everywhere).

    It fixes jump to definition problem in PHPStorm with ide-helper, and it's "Laravel way".

    opened by rap2hpoutre 10
  • v4.0 - Laravel 5.5 support, package auto-discovery, various changes & new features

    v4.0 - Laravel 5.5 support, package auto-discovery, various changes & new features

    Also removing backwards compatibility and changing some internal workings, so this will be a major release (4.x).

    See the Changelog for details.

    Still to do:

    • [x] Wait until Laravel 5.5 is released
    • [x] Update Laravel documentation links in README from 5.4 to 5.5
    • [x] Update installation instructions
    • [x] Merge into master
    • [x] Release it
    • [ ] Delete 4.x branch (to avoid confusion with master branch)
    opened by d13r 10
  • Missing argument 2 for DaveJamesMiller\Breadcrumbs

    Missing argument 2 for DaveJamesMiller\Breadcrumbs

    Summary of issue Don't understand from readme how to make breadcrumbs for dynamic pages. In this issue news breadcrumb is not working

    The complete error message, including file & line numbers Whoops, looks like something went wrong. 3/3 ErrorException in breadcrumbs.php line 18: Missing argument 2 for DaveJamesMiller\Breadcrumbs\ServiceProvider::{closure}() (View: D:\OpenServer\domains\steklo.dev\resources\views\layout\main.blade.php) (View: D:\OpenServer\domains\steklo.dev\resources\views\layout\main.blade.php)

    in breadcrumbs.php line 18
    at CompilerEngine->handleViewException(object(ErrorException), '0') in PhpEngine.php line 44
    at PhpEngine->evaluatePath('D:\OpenServer\domains\steklo.dev\storage\framework\views/9b61103ef370efee6e92ee9ec6a20ced', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'news' => object(LengthAwarePaginator), 'category' => object(Category))) in CompilerEngine.php line 58
    at CompilerEngine->get('D:\OpenServer\domains\steklo.dev\resources\views/news/index.blade.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'news' => object(LengthAwarePaginator), 'category' => object(Category))) in View.php line 147
    at View->getContents() in View.php line 118
    at View->renderContents() in View.php line 83
    at View->render() in Response.php line 51
    at Response->setContent(object(View)) in Response.php line 202
    at Response->__construct(object(View)) in Router.php line 1229
    at Router->prepareResponse(object(Request), object(View)) in ControllerDispatcher.php line 113
    at ControllerDispatcher->Illuminate\Routing\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
    at Pipeline->then(object(Closure)) in ControllerDispatcher.php line 114
    at ControllerDispatcher->callWithinStack(object(NewsController), object(Route), object(Request), 'getItem') in ControllerDispatcher.php line 69
    at ControllerDispatcher->dispatch(object(Route), object(Request), 'App\Http\Controllers\NewsController', 'getItem') in Route.php line 203
    at Route->runWithCustomDispatcher(object(Request)) in Route.php line 134
    at Route->run(object(Request)) in Router.php line 708
    at Router->Illuminate\Routing\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
    at Pipeline->then(object(Closure)) in Router.php line 710
    at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 675
    at Router->dispatchToRoute(object(Request)) in Router.php line 635
    at Router->dispatch(object(Request)) in Kernel.php line 236
    at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in VerifyCsrfToken.php line 50
    at VerifyCsrfToken->handle(object(Request), object(Closure))
    at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in ShareErrorsFromSession.php line 49
    at ShareErrorsFromSession->handle(object(Request), object(Closure))
    at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in StartSession.php line 62
    at StartSession->handle(object(Request), object(Closure))
    at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
    at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))
    at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in EncryptCookies.php line 59
    at EncryptCookies->handle(object(Request), object(Closure))
    at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in CheckForMaintenanceMode.php line 44
    at CheckForMaintenanceMode->handle(object(Request), object(Closure))
    at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
    at Pipeline->then(object(Closure)) in Kernel.php line 122
    at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 87
    at Kernel->handle(object(Request)) in index.php line 54
    

    2/3 ErrorException in breadcrumbs.php line 18: Missing argument 2 for DaveJamesMiller\Breadcrumbs\ServiceProvider::{closure}() (View: D:\OpenServer\domains\steklo.dev\resources\views\layout\main.blade.php)

    in breadcrumbs.php line 18
    at CompilerEngine->handleViewException(object(ErrorException), '1') in PhpEngine.php line 44
    at PhpEngine->evaluatePath('D:\OpenServer\domains\steklo.dev\storage\framework\views/b8265e1c9553960797f29caaf0b1dd60', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'obLevel' => '0', 'news' => object(LengthAwarePaginator), 'category' => object(Category), 'item' => object(News))) in CompilerEngine.php line 58
    at CompilerEngine->get('D:\OpenServer\domains\steklo.dev\resources\views/layout/main.blade.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'obLevel' => '0', 'news' => object(LengthAwarePaginator), 'category' => object(Category), 'item' => object(News))) in View.php line 147
    at View->getContents() in View.php line 118
    at View->renderContents() in View.php line 83
    at View->render() in 9b61103ef370efee6e92ee9ec6a20ced line 41
    at include('D:\OpenServer\domains\steklo.dev\storage\framework\views\9b61103ef370efee6e92ee9ec6a20ced') in PhpEngine.php line 42
    at PhpEngine->evaluatePath('D:\OpenServer\domains\steklo.dev\storage\framework\views/9b61103ef370efee6e92ee9ec6a20ced', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'news' => object(LengthAwarePaginator), 'category' => object(Category))) in CompilerEngine.php line 58
    at CompilerEngine->get('D:\OpenServer\domains\steklo.dev\resources\views/news/index.blade.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'news' => object(LengthAwarePaginator), 'category' => object(Category))) in View.php line 147
    at View->getContents() in View.php line 118
    at View->renderContents() in View.php line 83
    at View->render() in Response.php line 51
    at Response->setContent(object(View)) in Response.php line 202
    at Response->__construct(object(View)) in Router.php line 1229
    at Router->prepareResponse(object(Request), object(View)) in ControllerDispatcher.php line 113
    at ControllerDispatcher->Illuminate\Routing\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
    at Pipeline->then(object(Closure)) in ControllerDispatcher.php line 114
    at ControllerDispatcher->callWithinStack(object(NewsController), object(Route), object(Request), 'getItem') in ControllerDispatcher.php line 69
    at ControllerDispatcher->dispatch(object(Route), object(Request), 'App\Http\Controllers\NewsController', 'getItem') in Route.php line 203
    at Route->runWithCustomDispatcher(object(Request)) in Route.php line 134
    at Route->run(object(Request)) in Router.php line 708
    at Router->Illuminate\Routing\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
    at Pipeline->then(object(Closure)) in Router.php line 710
    at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 675
    at Router->dispatchToRoute(object(Request)) in Router.php line 635
    at Router->dispatch(object(Request)) in Kernel.php line 236
    at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in VerifyCsrfToken.php line 50
    at VerifyCsrfToken->handle(object(Request), object(Closure))
    at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in ShareErrorsFromSession.php line 49
    at ShareErrorsFromSession->handle(object(Request), object(Closure))
    at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in StartSession.php line 62
    at StartSession->handle(object(Request), object(Closure))
    at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
    at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))
    at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in EncryptCookies.php line 59
    at EncryptCookies->handle(object(Request), object(Closure))
    at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in CheckForMaintenanceMode.php line 44
    at CheckForMaintenanceMode->handle(object(Request), object(Closure))
    at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
    at Pipeline->then(object(Closure)) in Kernel.php line 122
    at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 87
    at Kernel->handle(object(Request)) in index.php line 54
    

    1/3 ErrorException in breadcrumbs.php line 18: Missing argument 2 for DaveJamesMiller\Breadcrumbs\ServiceProvider::{closure}()

    in breadcrumbs.php line 18
    at HandleExceptions->handleError('2', 'Missing argument 2 for DaveJamesMiller\Breadcrumbs\ServiceProvider::{closure}()', 'D:\OpenServer\domains\steklo.dev\app\Http\breadcrumbs.php', '18', array('breadcrumbs' => object(Generator))) in breadcrumbs.php line 18
    at ServiceProvider->{closure}(object(Generator))
    at call_user_func_array(object(Closure), array(object(Generator))) in Generator.php line 24
    at Generator->call('news', array()) in Generator.php line 13
    at Generator->generate(array('home' => object(Closure), 'about' => object(Closure), 'news' => object(Closure), 'contacts' => object(Closure), 'sitemap' => object(Closure)), 'news', array()) in Manager.php line 92
    at Manager->render() in Facade.php line 213
    at Facade::__callStatic('render', array()) in b8265e1c9553960797f29caaf0b1dd60 line 47
    at Facade::render() in b8265e1c9553960797f29caaf0b1dd60 line 47
    at include('D:\OpenServer\domains\steklo.dev\storage\framework\views\b8265e1c9553960797f29caaf0b1dd60') in PhpEngine.php line 42
    at PhpEngine->evaluatePath('D:\OpenServer\domains\steklo.dev\storage\framework\views/b8265e1c9553960797f29caaf0b1dd60', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'obLevel' => '0', 'news' => object(LengthAwarePaginator), 'category' => object(Category), 'item' => object(News))) in CompilerEngine.php line 58
    at CompilerEngine->get('D:\OpenServer\domains\steklo.dev\resources\views/layout/main.blade.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'obLevel' => '0', 'news' => object(LengthAwarePaginator), 'category' => object(Category), 'item' => object(News))) in View.php line 147
    at View->getContents() in View.php line 118
    at View->renderContents() in View.php line 83
    at View->render() in 9b61103ef370efee6e92ee9ec6a20ced line 41
    at include('D:\OpenServer\domains\steklo.dev\storage\framework\views\9b61103ef370efee6e92ee9ec6a20ced') in PhpEngine.php line 42
    at PhpEngine->evaluatePath('D:\OpenServer\domains\steklo.dev\storage\framework\views/9b61103ef370efee6e92ee9ec6a20ced', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'news' => object(LengthAwarePaginator), 'category' => object(Category))) in CompilerEngine.php line 58
    at CompilerEngine->get('D:\OpenServer\domains\steklo.dev\resources\views/news/index.blade.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'news' => object(LengthAwarePaginator), 'category' => object(Category))) in View.php line 147
    at View->getContents() in View.php line 118
    at View->renderContents() in View.php line 83
    at View->render() in Response.php line 51
    at Response->setContent(object(View)) in Response.php line 202
    at Response->__construct(object(View)) in Router.php line 1229
    at Router->prepareResponse(object(Request), object(View)) in ControllerDispatcher.php line 113
    at ControllerDispatcher->Illuminate\Routing\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
    at Pipeline->then(object(Closure)) in ControllerDispatcher.php line 114
    at ControllerDispatcher->callWithinStack(object(NewsController), object(Route), object(Request), 'getItem') in ControllerDispatcher.php line 69
    at ControllerDispatcher->dispatch(object(Route), object(Request), 'App\Http\Controllers\NewsController', 'getItem') in Route.php line 203
    at Route->runWithCustomDispatcher(object(Request)) in Route.php line 134
    at Route->run(object(Request)) in Router.php line 708
    at Router->Illuminate\Routing\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
    at Pipeline->then(object(Closure)) in Router.php line 710
    at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 675
    at Router->dispatchToRoute(object(Request)) in Router.php line 635
    at Router->dispatch(object(Request)) in Kernel.php line 236
    at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in VerifyCsrfToken.php line 50
    at VerifyCsrfToken->handle(object(Request), object(Closure))
    at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in ShareErrorsFromSession.php line 49
    at ShareErrorsFromSession->handle(object(Request), object(Closure))
    at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in StartSession.php line 62
    at StartSession->handle(object(Request), object(Closure))
    at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
    at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))
    at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in EncryptCookies.php line 59
    at EncryptCookies->handle(object(Request), object(Closure))
    at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in CheckForMaintenanceMode.php line 44
    at CheckForMaintenanceMode->handle(object(Request), object(Closure))
    at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
    at Pipeline->then(object(Closure)) in Kernel.php line 122
    at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 87
    at Kernel->handle(object(Request)) in index.php line 54
    

    Software versions Laravel Breadcrumbs: 3.0.1 Laravel: 5.1.43 "name": "laravel/framework", "version": "v5.1.43", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", "reference": "db580b5b073ea3f1e095b30a75ae5d6394eb8e51" PHP: 5.5.28

    Copy of app/Http/breadcrumbs.php

    Breadcrumbs::register('home', function($breadcrumbs)
    {
        $breadcrumbs->push('Главная', route('home'));
    });
    Breadcrumbs::register('about', function($breadcrumbs)
    {
        $breadcrumbs->parent('home');
        $breadcrumbs->push('О компании', route('about'));
    });
    Breadcrumbs::register('news', function($breadcrumbs, $item) {
        $breadcrumbs->parent('home');
        $breadcrumbs->push($item->title, route('news'));
    });
    Breadcrumbs::register('contacts', function($breadcrumbs)
    {
        $breadcrumbs->parent('home');
        $breadcrumbs->push('Контакты', route('contacts'));
    });
    Breadcrumbs::register('sitemap', function($breadcrumbs)
    {
        $breadcrumbs->parent('home');
        $breadcrumbs->push('Карта сайта', route('sitemap'));
    });
    

    Copy of app/Http/routes.php

    Route::get('/', ['as' => 'home', 'uses' => 'HomeController@index']);
    Route::post('/', ['as' => 'callback', 'uses' => 'PostController@callback']);
    Route::get('o-kompanii', ['as' => 'about', 'uses' => 'PageController@o_kompanii']);
    Route::get('sitemap', ['as' => 'sitemap', 'uses' => 'CategoryController@sitemap']);
    Route::get('contacts',  ['as' => 'contacts', 'uses' => 'PageController@contacts']);
    Route::post('contacts', ['as' => 'sendmail', 'uses' => 'PageController@sendmail']);
    Route::get('news/{item?}', ['as' => 'news', 'uses' => 'NewsController@getItem']);
    

    Copy of the layout files resources/views/layout/master.blade.php

    <!DOCTYPE html>
    <html lang="en" ng-app="myapp">
    <head>
        <title>@yield('title', 'default pagetitle')</title>
        <link rel="stylesheet" href="{{ elixir("css/app.css") }}">
    </head>
    <body>
    
    <div id="main" class="container-fluid">
    
            <header class="main-header">
                <form class="search pull-left">
                   <i class="fa fa-search"> </i><input type="text" name="search" class="form-control fa fa-search" placeholder=" Найти...">
                </form>
                @include('modules.topmenu')
    
                <div class="callback">
                        <a href="/" class="root"> </a>
                        <a href="mailto:[email protected]">[email protected]</a><br>
                        <a class="btn btn-primary btn-large" href="#callback" title="Обратный звонок" data-toggle="modal" data-target="#callback">
                        <i class="fa fa-phone"> </i> Обратный звонок</a></p>
                </div>
                @include('modules.mainmenu')
            </header>
    
            {!! Breadcrumbs::render() !!}
    
            <section id="content" class="content col-md-12" style="clear:both;">@yield('content')</section>
    
            <div class="clearfix"></div>
            <section id="bottommodules" style="clear:both;">@yield('bottommodules')</section>
    
    </div><!-- ./ #main -->
    
        @include('modules.totop')
        @include('modules.callback')
        <!-- Scripts -->
        <script src="{{ elixir("js/all.js") }}"></script>
    
    
    {!! csrf_field() !!}
    </body>
    </html>
    

    Copy of config/app.php

    <?php
    
    return [
    
        'debug' => env('APP_DEBUG'),
    
        'url' => 'http://localhost',
    
        'timezone' => 'Europe/Moscow',
    
        'locale' => 'ru',
    
        'fallback_locale' => 'en',
    
        'key' => env('APP_KEY', 'SomeRandomString'),
    
        'cipher' => 'AES-256-CBC',
    
        'log' => 'single',
    
        'providers' => [
            Illuminate\Foundation\Providers\ArtisanServiceProvider::class,
            Illuminate\Auth\AuthServiceProvider::class,
            Illuminate\Broadcasting\BroadcastServiceProvider::class,
            Illuminate\Bus\BusServiceProvider::class,
            Illuminate\Cache\CacheServiceProvider::class,
            Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
            Illuminate\Routing\ControllerServiceProvider::class,
            Illuminate\Cookie\CookieServiceProvider::class,
            Illuminate\Database\DatabaseServiceProvider::class,
            Illuminate\Encryption\EncryptionServiceProvider::class,
            Illuminate\Filesystem\FilesystemServiceProvider::class,
            Illuminate\Foundation\Providers\FoundationServiceProvider::class,
            Illuminate\Hashing\HashServiceProvider::class,
            Illuminate\Mail\MailServiceProvider::class,
            Illuminate\Pagination\PaginationServiceProvider::class,
            Illuminate\Pipeline\PipelineServiceProvider::class,
            Illuminate\Queue\QueueServiceProvider::class,
            Illuminate\Redis\RedisServiceProvider::class,
            Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
            Illuminate\Session\SessionServiceProvider::class,
            Illuminate\Translation\TranslationServiceProvider::class,
            Illuminate\Validation\ValidationServiceProvider::class,
            Illuminate\View\ViewServiceProvider::class,
            App\Providers\AppServiceProvider::class,
            App\Providers\EventServiceProvider::class,
            App\Providers\RouteServiceProvider::class,
            'Orchestra\Imagine\ImagineServiceProvider',
            'Maatwebsite\Excel\ExcelServiceProvider',
            Collective\Html\HtmlServiceProvider::class,
            DaveJamesMiller\Breadcrumbs\ServiceProvider::class,
        ],
    
        'aliases' => [
    
            'App'       => Illuminate\Support\Facades\App::class,
            'Artisan'   => Illuminate\Support\Facades\Artisan::class,
            'Auth'      => Illuminate\Support\Facades\Auth::class,
            'Blade'     => Illuminate\Support\Facades\Blade::class,
            'Bus'       => Illuminate\Support\Facades\Bus::class,
            'Cache'     => Illuminate\Support\Facades\Cache::class,
            'Config'    => Illuminate\Support\Facades\Config::class,
            'Cookie'    => Illuminate\Support\Facades\Cookie::class,
            'Crypt'     => Illuminate\Support\Facades\Crypt::class,
            'DB'        => Illuminate\Support\Facades\DB::class,
            'Eloquent'  => Illuminate\Database\Eloquent\Model::class,
            'Event'     => Illuminate\Support\Facades\Event::class,
            'File'      => Illuminate\Support\Facades\File::class,
            'Hash'      => Illuminate\Support\Facades\Hash::class,
            'Input'     => Illuminate\Support\Facades\Input::class,
            'Inspiring' => Illuminate\Foundation\Inspiring::class,
            'Lang'      => Illuminate\Support\Facades\Lang::class,
            'Log'       => Illuminate\Support\Facades\Log::class,
            'Mail'      => Illuminate\Support\Facades\Mail::class,
            'Password'  => Illuminate\Support\Facades\Password::class,
            'Queue'     => Illuminate\Support\Facades\Queue::class,
            'Redirect'  => Illuminate\Support\Facades\Redirect::class,
            'Redis'     => Illuminate\Support\Facades\Redis::class,
            'Request'   => Illuminate\Support\Facades\Request::class,
            'Response'  => Illuminate\Support\Facades\Response::class,
            'Route'     => Illuminate\Support\Facades\Route::class,
            'Schema'    => Illuminate\Support\Facades\Schema::class,
            'Session'   => Illuminate\Support\Facades\Session::class,
            'Storage'   => Illuminate\Support\Facades\Storage::class,
            'URL'       => Illuminate\Support\Facades\URL::class,
            'Validator' => Illuminate\Support\Facades\Validator::class,
            'View'      => Illuminate\Support\Facades\View::class,
            'Imagine'   => 'Orchestra\Imagine\Facade',
            'Excel'     => 'Maatwebsite\Excel\Facades\Excel',
            'Form'      => Collective\Html\FormFacade::class,
            'Html'      => Collective\Html\HtmlFacade::class,
            'Breadcrumbs' => DaveJamesMiller\Breadcrumbs\Facade::class,
        ],
    
    ];
    
    

    Copy of App\Http\Controllers\NewsController.php

    <?php namespace App\Http\Controllers;
    use App\Category;
    use App\News;
    
    class NewsController extends Controller {
        public function getItem($item = null)
        {
    
            if ($item) {
                $item = News::where('sef', '=', $item)->first();
    
                $previous = News::where('id', '<', $item->id)->orderBy('id', 'desc')->first();
                $next = News::where('id', '>', $item->id)->orderBy('id', 'asc')->first();
                $category = Category::where('id', $item->category_id)->first();
    
                return view('news.item')
                            ->withCategory($category)
                            ->withItem($item)
                            ->withPrevious($previous)
                            ->withNext($next);
            }
            else {
                $category = Category::where('type', '=', 'news')->first();
                $news = News::orderBy('created_at', 'desc')->paginate(10); // все новости по 10 штук на страницу
                return view('news.index')->withNews($news)->withCategory($category);
            }
        }
    }
    
    
    opened by schel4ok 10
  • Added string class support

    Added string class support

    Add support for string classes (like routes)

    This is the first step for cached Breadcrumbs.

    Example: breadcrumbs.php

    <?php
    /**
    * The breadcrumbs.php
    **/
    
    
    Breadcrumbs::register('project-home', function($breadcrumbs, $param)
    {
        $breadcrumbs->push('Home - ' . $param, '');
    });
    //Call add methode in ProjectBreadcrumbController class
    Breadcrumbs::register('project-timeline', '\App\Breadcrumbs\ProjectBreadcrumbController@add');
    //Call timeline methode in ProjectBreadcrumbController class
    Breadcrumbs::register('project-timeline', \App\Breadcrumbs\ProjectBreadcrumbController::class.'@timeline');
    //Call __invoke methode in ProjectBreadcrumbController class
    Breadcrumbs::register('project-events', \App\Breadcrumbs\ProjectBreadcrumbController::class);
    

    Example: ProjectBreadcrumbController

    <?php
    
    namespace App\Breadcrumbs;
    
    use DaveJamesMiller\Breadcrumbs\Generator;
    
    class ProjectBreadcrumbController
    {
    
        public function timeline(Generator $breadcrumbs, $time = '')
        {
            $breadcrumbs->push('Timeline- ' . $time, '');
        }
    
       public function add(Generator $breadcrumbs)
        {
            $breadcrumbs->push('Add');
        }
    
        function __invoke(Generator $breadcrumbs)
        {
            $breadcrumbs->push('Events', '');
        }
    }
    
    opened by xeno010 10
  • Laravel 5 - BadMethodCallException in ServiceProvider.php line 111: Call to undefined method [package]

    Laravel 5 - BadMethodCallException in ServiceProvider.php line 111: Call to undefined method [package]

    breadcrumbs.php

    Breadcrumbs::register('home', function($breadcrumbs) {
        $breadcrumbs->push('Home', '/');
    });
    

    my view

    //...
    {!! Breadcrumbs::render('home') !!}
    //...
    

    Error

    BadMethodCallException in ServiceProvider.php line 111:
    Call to undefined method [package]
    
    in ServiceProvider.php line 111
    at ServiceProvider->__call('package', array('davejamesmiller/laravel-breadcrumbs')) in ServiceProvider.php line 50
    at ServiceProvider->package('davejamesmiller/laravel-breadcrumbs') in ServiceProvider.php line 50
    at ServiceProvider->boot()
    at call_user_func_array(array(object(ServiceProvider), 'boot'), array()) in Container.php line 530
    at Container->call(array(object(ServiceProvider), 'boot')) in Application.php line 564
    at Application->bootProvider(object(ServiceProvider)) in Application.php line 377
    at Application->register(object(ServiceProvider)) in Application.php line 476
    at Application->registerDeferredProvider('DaveJamesMiller\Breadcrumbs\ServiceProvider', 'breadcrumbs') in Application.php line 458
    at Application->loadDeferredProvider('breadcrumbs') in Application.php line 502
    at Application->make('breadcrumbs') in Container.php line 1191
    at Container->offsetGet('breadcrumbs') in Facade.php line 148
    at Facade::resolveFacadeInstance('breadcrumbs') in Facade.php line 118
    at Facade::getFacadeRoot() in Facade.php line 202
    at Facade::__callStatic('render', array('home')) in c51afa214851930e34b35b9f120f93e7 line 9
    at Facade::render('home') in c51afa214851930e34b35b9f120f93e7 line 9
    at include('/home/vagrant/Code/ead/storage/framework/views/c51afa214851930e34b35b9f120f93e7') in PhpEngine.php line 37
    at PhpEngine->evaluatePath('/home/vagrant/Code/ead/storage/framework/views/c51afa214851930e34b35b9f120f93e7', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'obLevel' => '1', 'course' => object(Course), 'lesson' => object(Lesson), 'files' => object(Collection), 'header_title' => 'O Cliente', 'header_subtitle' => 'Entendendo O Cliente', 'edit' => '/courses/4/lessons/5/edit', 'delete' => 'courses/4/lessons/5')) in CompilerEngine.php line 57
    at CompilerEngine->get('/home/vagrant/Code/ead/resources/templates/courses/pageheader-edit.blade.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'obLevel' => '1', 'course' => object(Course), 'lesson' => object(Lesson), 'files' => object(Collection), 'header_title' => 'O Cliente', 'header_subtitle' => 'Entendendo O Cliente', 'edit' => '/courses/4/lessons/5/edit', 'delete' => 'courses/4/lessons/5')) in View.php line 136
    at View->getContents() in View.php line 104
    at View->renderContents() in View.php line 78
    at View->render() in 04a3a5d2f2451fa4289af95c613de8f2 line 10
    at include('/home/vagrant/Code/ead/storage/framework/views/04a3a5d2f2451fa4289af95c613de8f2') in PhpEngine.php line 37
    at PhpEngine->evaluatePath('/home/vagrant/Code/ead/storage/framework/views/04a3a5d2f2451fa4289af95c613de8f2', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'course' => object(Course), 'lesson' => object(Lesson), 'files' => object(Collection))) in CompilerEngine.php line 57
    at CompilerEngine->get('/home/vagrant/Code/ead/resources/templates/lessons/show.blade.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'course' => object(Course), 'lesson' => object(Lesson), 'files' => object(Collection))) in View.php line 136
    at View->getContents() in View.php line 104
    at View->renderContents() in View.php line 78
    at View->render() in Response.php line 44
    at Response->setContent(object(View)) in Response.php line 202
    at Response->__construct(object(View)) in Router.php line 1171
    at Router->prepareResponse(object(Request), object(View)) in Router.php line 649
    at Router->dispatchToRoute(object(Request)) in Router.php line 604
    at Router->dispatch(object(Request)) in Kernel.php line 155
    at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 141
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in VerifyCsrfToken.php line 43
    at VerifyCsrfToken->handle(object(Request), object(Closure)) in Pipeline.php line 125
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in ShareErrorsFromSession.php line 55
    at ShareErrorsFromSession->handle(object(Request), object(Closure)) in Pipeline.php line 125
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in StartSession.php line 53
    at StartSession->handle(object(Request), object(Closure)) in Pipeline.php line 125
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 36
    at AddQueuedCookiesToResponse->handle(object(Request), object(Closure)) in Pipeline.php line 125
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in EncryptCookies.php line 40
    at EncryptCookies->handle(object(Request), object(Closure)) in Pipeline.php line 125
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in CheckForMaintenanceMode.php line 42
    at CheckForMaintenanceMode->handle(object(Request), object(Closure)) in Pipeline.php line 125
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 101
    at Pipeline->then(object(Closure)) in Kernel.php line 108
    at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 83
    at Kernel->handle(object(Request)) in index.php line 53
    
    opened by BrunoQuaresma 10
  • Loosen constraints for Laravel 5.6

    Loosen constraints for Laravel 5.6

    I know it was only released a couple of hours ago but this extends the support for Laravel 5.5 to include 5.6 as well. This allows the current version of the package to work with both versions.

    It also upgrades Testbench for Laravel 5.6 so that the package is tested against it, as well as upgrading PHPUnit as that's the current version used by Laravel.

    opened by dwightwatson 9
  • Class 'DaveJamesMiller\Breadcrumbs\ServiceProvider' not found

    Class 'DaveJamesMiller\Breadcrumbs\ServiceProvider' not found

    Hi,

    I am facing following error:

    Class 'DaveJamesMiller\Breadcrumbs\ServiceProvider' not found

    Please help me, I follow complete instruction when installing.

    I am installing package in Laravel 4.42 version.

    Thanks in advance.

    opened by khalid11 9
  • Illegal offset type in isset or empty

    Illegal offset type in isset or empty

    I'm getting an Illegal offset type in isset or empty error. Background: I'm creating a package for easy deployment of the code I use for every website I make. I've even tried to deploy the package but get the same error.

    Providers from config/app.php

    'providers' => array(
    
            'Illuminate\Foundation\Providers\ArtisanServiceProvider',
            'Illuminate\Auth\AuthServiceProvider',
            'Illuminate\Cache\CacheServiceProvider',
            'Illuminate\Session\CommandsServiceProvider',
            'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider',
            'Illuminate\Routing\ControllerServiceProvider',
            'Illuminate\Cookie\CookieServiceProvider',
            'Illuminate\Database\DatabaseServiceProvider',
            'Illuminate\Encryption\EncryptionServiceProvider',
            'Illuminate\Filesystem\FilesystemServiceProvider',
            'Illuminate\Hashing\HashServiceProvider',
            'Illuminate\Html\HtmlServiceProvider',
            'Illuminate\Log\LogServiceProvider',
            'Illuminate\Mail\MailServiceProvider',
            'Illuminate\Database\MigrationServiceProvider',
            'Illuminate\Pagination\PaginationServiceProvider',
            'Illuminate\Queue\QueueServiceProvider',
            'Illuminate\Redis\RedisServiceProvider',
            'Illuminate\Remote\RemoteServiceProvider',
            'Illuminate\Auth\Reminders\ReminderServiceProvider',
            'Illuminate\Database\SeedServiceProvider',
            'Illuminate\Session\SessionServiceProvider',
            'Illuminate\Translation\TranslationServiceProvider',
            'Illuminate\Validation\ValidationServiceProvider',
            'Illuminate\View\ViewServiceProvider',
            'Illuminate\Workbench\WorkbenchServiceProvider',
    
            'Cartalyst\Sentry\SentryServiceProvider',   //Required For DCN's Auth Package
            'Cviebrock\EloquentSluggable\SluggableServiceProvider', //Required For DCN's Blog And Page Packages
            'Baum\BaumServiceProvider', //Required For DCN's Blog And Page Packages
            'DaveJamesMiller\Breadcrumbs\ServiceProvider', //required for all DCN packages
    
            'Dcn\Auth\AuthServiceProvider',         //DCN's Auth Package        
    
            'Dcn\Blog\BlogServiceProvider',         //DCN's Blog Package
    
            'Dcn\Pages\PagesServiceProvider',           //DCN's Page Package
    
        ),
    

    Aliases from config/app.php

    'aliases' => array(
    
            'App'             => 'Illuminate\Support\Facades\App',
            'Artisan'         => 'Illuminate\Support\Facades\Artisan',
            'Auth'            => 'Illuminate\Support\Facades\Auth',
            'Blade'           => 'Illuminate\Support\Facades\Blade',
            'Cache'           => 'Illuminate\Support\Facades\Cache',
            'ClassLoader'     => 'Illuminate\Support\ClassLoader',
            'Config'          => 'Illuminate\Support\Facades\Config',
            'Controller'      => 'Illuminate\Routing\Controller',
            'Cookie'          => 'Illuminate\Support\Facades\Cookie',
            'Crypt'           => 'Illuminate\Support\Facades\Crypt',
            'DB'              => 'Illuminate\Support\Facades\DB',
            'Eloquent'        => 'Illuminate\Database\Eloquent\Model',
            'Event'           => 'Illuminate\Support\Facades\Event',
            'File'            => 'Illuminate\Support\Facades\File',
            'Form'            => 'Illuminate\Support\Facades\Form',
            'Hash'            => 'Illuminate\Support\Facades\Hash',
            'HTML'            => 'Illuminate\Support\Facades\HTML',
            'Input'           => 'Illuminate\Support\Facades\Input',
            'Lang'            => 'Illuminate\Support\Facades\Lang',
            'Log'             => 'Illuminate\Support\Facades\Log',
            'Mail'            => 'Illuminate\Support\Facades\Mail',
            'Paginator'       => 'Illuminate\Support\Facades\Paginator',
            'Password'        => 'Illuminate\Support\Facades\Password',
            'Queue'           => 'Illuminate\Support\Facades\Queue',
            'Redirect'        => 'Illuminate\Support\Facades\Redirect',
            'Redis'           => 'Illuminate\Support\Facades\Redis',
            'Request'         => 'Illuminate\Support\Facades\Request',
            'Response'        => 'Illuminate\Support\Facades\Response',
            'Route'           => 'Illuminate\Support\Facades\Route',
            'Schema'          => 'Illuminate\Support\Facades\Schema',
            'Seeder'          => 'Illuminate\Database\Seeder',
            'Session'         => 'Illuminate\Support\Facades\Session',
            'SoftDeletingTrait' => 'Illuminate\Database\Eloquent\SoftDeletingTrait',
            'SSH'             => 'Illuminate\Support\Facades\SSH',
            'Str'             => 'Illuminate\Support\Str',
            'URL'             => 'Illuminate\Support\Facades\URL',
            'Validator'       => 'Illuminate\Support\Facades\Validator',
            'View'            => 'Illuminate\Support\Facades\View',
    
            'Sentry' => 'Cartalyst\Sentry\Facades\Laravel\Sentry',
    
            'Breadcrumbs' => 'DaveJamesMiller\Breadcrumbs\Facade',
    
        ),
    

    One of my views

    <p>
    {{\Dcn\Pages\Page::navigation()}}
    </p>
    <p>
    {{ Breadcrumbs::render('Pages-Home') }}
    </p>
    <h1>{{$page->title}}</h1>
    <p>Created by {{$page->writer->first_name}} {{$page->writer->last_name}}</p>
    <p>Last Update: {{$page->updated_at}} By: {{$page->updater->first_name}} {{$page->updater->last_name}}</p>
    {{$page->content}}
    

    my breadcrumbs.php

    <?php
    
    Breadcrumbs::register('Pages-Home', function($breadcrumbs) {
        $breadcrumbs->push('Home', route('Pages-Home'));
    });
    
    Breadcrumbs::register('Pages-ContactUs', function($breadcrumbs) {
        $breadcrumbs->parent('Pages-Home');
        $breadcrumbs->push('Contact Us', route('Pages-ContactUs'));
    });
    
    Breadcrumbs::register('Pages-TermsOfService', function($breadcrumbs) {
        $breadcrumbs->parent('Pages-Home');
        $breadcrumbs->push('Terms Of Service', route('Pages-TermsOfService'));
    });
    
    Breadcrumbs::register('Pages-PrivacyPolicy', function($breadcrumbs) {
        $breadcrumbs->parent('Pages-Home');
        $breadcrumbs->push('Privacy Policy', route('Pages-PrivacyPolicy'));
    });
    
    Breadcrumbs::register('Pages-View', function($breadcrumbs, $page) {
        $breadcrumbs->parent('Pages-Home');
    
        foreach ($page->getAncestors() as $ancestor) {
            $breadcrumbs->push($ancestor->title, route('Pages-View', $ancestor->slug));
        }
    
        $breadcrumbs->push($page->title, route('Pages-View', $page->slug));
    });
    

    My service Providor

    <?php namespace Dcn\Pages;
    
    use Illuminate\Support\ServiceProvider;
    
    class PagesServiceProvider extends ServiceProvider {
    
        /**
         * Indicates if loading of the provider is deferred.
         *
         * @var bool
         */
        protected $defer = false;
    
        /**
         * Bootstrap the application events.
         *
         * @return void
         */
        public function boot()
        {
            $this->package('dcn/pages');
    
            include __DIR__.'/../../routes.php';
            include __DIR__.'/../../breadcrumbs.php';
        }
    
        /**
         * Register the service provider.
         *
         * @return void
         */
        public function register()
        {
            //
        }
    
        /**
         * Get the services provided by the provider.
         *
         * @return array
         */
        public function provides()
        {
            return array();
        }
    
    }
    

    Laravel Version 4.2.6 PHP Version 5.4.20

    Full package code can be found at: https://github.com/DynamicCodeNinja/pages

    I'm sure its something simple I'm missing, but I will continue to debug and look into it.

    The only weird thing, is that if I add Breadcrumbs::setView('laravel-breadcrumbs::bootstrap3'); into my breadcumbs.php file it works. So I think that the config isn't being loaded properly.

    opened by sniper7kills 9
  • Added support arrow function

    Added support arrow function

    This sentence modifies the return value for generator methods.

    Before

    Breadcrumbs::for('home', function ($trail) {
        $trail->parent('home');
        $trail->push('About');
    });
    

    After

    Breadcrumbs::for('home', function ($trail) {
        $trail->parent('home')->push('About');
    });
    

    This small change does not affect backward compatibility. At the same time, it supports arrow functions:

    Breadcrumbs::for('home', fn ($trail) =>
        $trail->parent('home')->push('About')
    );
    
    opened by tabuna 0
DEPRECATED - Please use the GitLab.com issue tracker

GitLab CI is an open-source continuous integration server GitLab CI 8.0 GitLab CI is now integrated in GitLab. The last 'stand-alone' version of GitLa

GitLab 1.5k Dec 14, 2022
[OUTDATED] Two-factor authentication for Symfony applications 🔐 (bunde version ≤ 4). Please use version 5 from https://github.com/scheb/2fa.

scheb/two-factor-bundle ⚠ Outdated version. Please use versions ≥ 5 from scheb/2fa. This bundle provides two-factor authentication for your Symfony ap

Christian Scheb 389 Nov 15, 2022
TO DO LIST WITH LOGIN AND SIGN UP and LOGOUT using PHP and MySQL please do edit the _dbconnect.php before viewing the website.

TO-DO-LIST-WITH-LOGIN-AND-SIGN-UP TO DO LIST WITH LOGIN AND SIGN UP and LOGOUT using PHP and MySQL please do edit the _dbconnect.php before viewing th

Aniket Singh 2 Sep 28, 2021
Phalcon PHP REST API Package, still in beta, please submit issues or pull requests

PhREST API A Phalcon REST API package, based on Apigees guidelines as found in http://apigee.com/about/content/web-api-design Please see the skeleton

PhREST 29 Dec 27, 2022
A php API documentation generator, fork of Sami

Doctum, a PHP API documentation generator. Fork of Sami Curious about what Doctum generates? Have a look at the MariaDB MySQL Kbs or Laravel documenta

Code LTS 203 Dec 21, 2022
A fork of Laravel Valet to work in Linux.

Introduction Valet Linux is a Laravel development environment for Linux minimalists. No Vagrant, no /etc/hosts file. You can even share your sites pub

Carlos Priego 1.2k Dec 31, 2022
(Hard) Fork of WordPress Plugin Boilerplate, actively taking PRs and actively maintained. Following WordPress Coding Standards. With more features than the original.

Better WordPress Plugin Boilerplate This is a Hard Fork of the original WordPress Plugin Boilerplate. The Better WordPress Plugin Boilerplate actively

Beda Schmid 46 Dec 7, 2022
A fork of jasonwynn10ˋs VanillaEntityAI Plugin.

BIG UPDATE: MobPlugin 1.0.0-ALPHA. Based on the Altay AI. Coming soon! MobPlugin-PM A fork of jasonwynn10ˋs VanillaEntityAI Plugin. Similar to the Mob

BalkanDev 9 Dec 23, 2022
A fork of Laravel Valet to work in Linux.

Introduction Valet Linux is a Laravel development environment for Linux minimalists. No Vagrant, no /etc/hosts file. You can even share your sites pub

Carlos Priego 1.2k Dec 31, 2022
Fork from hautelook/phpass since that repo was deleted.

This repository is a fork from the original hautelook/phpass which seems to have been deleted on 2021-09-09. Openwall Phpass, modernized This is Openw

Gustavo Bordoni 18 Nov 13, 2022
Fork of Symfony Rate Limiter Component for Symfony 4

Rate Limiter Component Fork (Compatible with Symfony <=4.4) The Rate Limiter component provides a Token Bucket implementation to rate limit input and

AvaiBook by idealista 4 Apr 19, 2022
PHP implementation of JSON schema. Fork of the http://jsonschemaphpv.sourceforge.net/ project

JSON Schema for PHP A PHP Implementation for validating JSON Structures against a given Schema with support for Schemas of Draft-3 or Draft-4. Feature

Justin Rainbow 3.4k Dec 26, 2022
AlphaholicCore is a fork of PocketMine-MP for 0.14.3

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the F

kotyara 3 Jun 25, 2022
Fork is an easy to use open source CMS using Symfony Components.

Installation Make sure you have composer installed. Run composer create-project forkcms/forkcms . in your document root. Browse to your website Follow

Fork CMS 1.1k Dec 8, 2022
Surf, an opinionated fork of Wave - the SAAS starter kit, with Laravel 9.

Surf ??‍♀️ Introduction Surf, the opinionated Software as a Service Starter Kit that can help you build your next great idea ?? . Surf is fork off Wav

Kim Hallberg 14 Oct 6, 2022
Initiated by me, enhanced by us, created for us. This is the fork (public) version separated from my private diary repository.

diary public repository Initiated by me, enhanced by us, created for us. This is the fork (public) version separated from my private diary repository.

Weicheng Ao 3 Jul 30, 2022
[READ ONLY] Subtree split of the Illuminate Database component (see laravel/framework)

Illuminate Database The Illuminate Database component is a full database toolkit for PHP, providing an expressive query builder, ActiveRecord style OR

The Laravel Components 2.5k Dec 27, 2022
[Deprecated] We now recommend using Laravel Scout, see =>

[DEPRECATED] Algolia Search API Client for Laravel Algolia Search is a hosted full-text, numerical, and faceted search engine capable of delivering re

Algolia 240 Nov 25, 2022
A TYPO3 extension that integrates the Apache Solr search server with TYPO3 CMS. dkd Internet Service GmbH is developing the extension. Community contributions are welcome. See CONTRIBUTING.md for details.

Apache Solr for TYPO3 CMS A TYPO3 extension that integrates the Apache Solr enterprise search server with TYPO3 CMS. The extension has initially been

Apache Solr for TYPO3 126 Dec 7, 2022