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.
is your code on github or something that we can take a full look at?
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') }}
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.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community