Support the ongoing development of Laravel.io →
posted 8 years ago
Views Blade
Last updated 2 years ago.
0

Is this a new installation, or did you do an upgrade?

0

It's a new installation.

I've cleared the cache, views, routes, config and dump-autoload.

When I do a route:list, it recognizes every other route except for home.

Last updated 8 years ago.
0

Any ideas? I'm stuck and can't move forward with my app at all.

0

is your code on github or something that we can take a full look at?

0

Did you already found a solution? I have exactly the same problem. My route is at the top of the route file. I also remove the middleware from the route but it doesn't help. My route is very basic and not complex at all. And all my other routes are working.

Route::get('/', [
'as' => 'guest.home',
'uses' => 'Guest\HomeController@getIndex',
'middleware' => 'guest'
]);

This is how I call it: {{ route('guest.home') }}

Last updated 8 years ago.
0

Same problem here.

It seems there is a pretty serious bug in the framework. The relevant code in framework's RouteCollection.php file:

protected function addLookups($route)
{
    // If the route has a name, we will add it to the name look-up table so that we
    // will quickly be able to find any route associate with a name and not have
    // to iterate through every route every time we need to perform a look-up.
    $action = $route->getAction();

    if (isset($action['as'])) {
        $this->nameList[$action['as']] = $route;
    }

    // When the route is routing to a controller we will also store the action that
    // is used by the route. This will let us reverse route to controllers while
    // processing a request and easily generate URLs to the given controllers.
    if (isset($action['controller'])) {
        $this->addToActionList($action, $route);
    }
}

Problem is that when you set named route through name() method, there is no index 'as'... so it will never register the name.

EDIT: I jumped into conclusion too hastily. The issue is actually that name for a route is set too late! For me the issue was simply I was trying to resolve route (with route() helper method) too early. Apparently you can not do this from Service Provider's boot method because route listing is not fully built at that point.

Last updated 8 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

jerauf jerauf Joined 16 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.