you are calling that in one of your controllers right? Otherwise it wouldn't throw that error..
php artisan route:list returns error
Hi, I wanted to see all my routes, so I typed:
'php artisan route:list'
And I get this error:
[Symfony\Component\Debug\Exception\FatalErrorException]
Call to a member function getName() on a non-object
I looked it up in the log files, the problem is inside of a controller. This line is causing the error:
$this->routeName = $request->route()->getName();
$request->route()
somehow returns 'null' but I don't know why :/
I don't know where I should start looking to fix this problem that's why I can't really give any other information. Maybe you have an idea?
Thank you
Dennis
When you run route:list you are not accessing a route so the function fails. You can simply check if route exists before you get the name
$this->routeName = $request->route() ? $request->route()->getName() : '';
Please or to participate in this conversation.