Skip to content

Exception when rendering breadcrumbs on Laravel 404 error page #38

Closed
@lewislarsen

Description

@lewislarsen

When overriding the default 404 template with a template that uses breadcrumbs in the view, and navigating to a implictly bound route that 404's you encounter the following error:

Diglactic\Breadcrumbs\ServiceProvider::{closure}(): Argument #2 ($directory) must be of type App\Models\Directory, string given

Here's the relevant breadcrumbs

Breadcrumbs::for('directory.show', function (BreadcrumbTrail $trail, Directory $directory) {
    $trail->parent('directory.index');
    $trail->push($directory->title, route('directory.show', ['directory' => $directory]));
});
// 404
Breadcrumbs::for('errors.404', function (BreadcrumbTrail $trail) {
    $trail->push('Page Not Found');
});

Would you happen to know the best way to resolve this? Going to look into it myself too. :)

Metadata

Metadata

Assignees

Labels

wontfixThis will not be worked on

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions