Call to undefined method Illuminate\Routing\RouteFileRegistrar::get() - Error after upgrading from Laravel 5.7 to 5.8
Asked Answered
P

2

11

I have a running app written on Laravel 5.7. I tried to change the record in composer.json to match "5.8.*" and ran composer update. On my local (win10/WAMP) machine it went fine, but on the staging server (Debian 9/nginx) the update command changed the vendor contents and failed at the end. Since then anything I do with the app on the server I get this error and I can't find any information anywhere.

Call to undefined method Illuminate\Routing\RouteFileRegistrar::get()

And this is the line that fails:

$this->get('login', 'Auth\LoginController@showLoginForm')->name('login');

Thanks in advance!

Phyte answered 19/5, 2019 at 1:50 Comment(7)
What's $this? Where is the line located?Ryon
in routes/web.phpPhyte
Does it work if you do Route::get instead, per the docs?Ryon
Yes, but it doesn't answer why it happened in the first place. This is not mentioned in the upgrade guide.Phyte
I don't see mention of it in the upgrade guide, but none of the docs on routing - from 5.0 through 5.8 ever suggest/condone using $this instead of Route::.Ryon
I'm pretty sure I'm not the only one who does that. It would be nice to keep this if anyone else stumbles upon it.Phyte
FYI, $this->router->get appears to work. Looks like some internals shuffling around.Ryon
C
22

remove "$this" from your routes and use "Route::"

Corroborate answered 23/6, 2019 at 17:7 Comment(0)
P
0

It is a problem with the routes. Mainly, you get this problem when you are using routes with resource or resources. Make sure you do not have any problem in routes by using the command:

    #php artisan route:list

If you are getting any problem while route listing please fix it. I solved this problem in Laravel 5.8 by fixing routes. Hope this will help.

Preclude answered 21/5, 2019 at 5:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.