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!

Boyan
  • 456
  • 3
  • 16
  • 1
    What's `$this`? Where is the line located? – ceejayoz May 19 '19 at 01:57
  • 1
    in routes/web.php – Boyan May 19 '19 at 01:58
  • 3
    Does it work if you do `Route::get` instead, [per the docs](https://laravel.com/docs/5.8/routing)? – ceejayoz May 19 '19 at 02:01
  • Yes, but it doesn't answer why it happened in the first place. This is not mentioned in the upgrade guide. – Boyan May 19 '19 at 02:03
  • 4
    I don't see mention of it in the upgrade guide, but none of the docs on routing - from [5.0](https://laravel.com/docs/5.0/routing) through [5.8](https://laravel.com/docs/5.8/routing) ever suggest/condone using `$this` instead of `Route::`. – ceejayoz May 19 '19 at 02:06
  • 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. – Boyan May 19 '19 at 02:07
  • 3
    FYI, `$this->router->get` appears to work. Looks like some internals shuffling around. – ceejayoz May 19 '19 at 02:08

2 Answers2

22

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

Abed Bilani
  • 614
  • 6
  • 7
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.

Ramesh KC
  • 589
  • 4
  • 10