Skip to content
This repository has been archived by the owner on Oct 18, 2020. It is now read-only.
This repository has been archived by the owner on Oct 18, 2020. It is now read-only.

Add support for not errorring out when a route is not set #40

Closed
rickywiens opened this issue Aug 1, 2014 · 1 comment
Closed

Add support for not errorring out when a route is not set #40

rickywiens opened this issue Aug 1, 2014 · 1 comment

Comments

@rickywiens
Copy link

I'm trying to use the App::missing() handler to handle my 404 errors nicely, while still having a call to Breadcrumbs::renderIfExists() in my parent template (Which I am expecting to not load any breadcrumbs).

However, if the page is 404ing and the route is not set anywhere, I get this error:

Symfony \ Component \ Debug \ Exception \ FatalErrorException
Call to a member function getName() on a non-object.

This is because here in /laravel-breadcrumbs/src/DaveJamesMiller/Breadcrumbs/Manager.php:

    protected function currentRoute()
    {
        if ($this->currentRoute)
            return $this->currentRoute;

        $route = $this->router->current();

        $name = $route->getName();
//...

It tries to access the getName() function of a route that doesn't exist.

For example if you have no route called "dfpoigsjpdofg" and you go to that URI App::missing() will handle the error, and I want to use my parent template to style a nice 404 page, but I have to override the breadcrumb call or else it'll error out like this.

If you'd be interested in merging this in, I'd be willing to add it in and drop you a pull request for it.

@d13r
Copy link
Owner

d13r commented Aug 1, 2014

Sure, PR would be good. Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants