Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Method [username] does not exist at login when upgrade from Laravel 5.2 to 5.3

After I recently upgraded Laravel from 5.2 to 5.3, I cannot login in to my app.

For a simple login I receive: BadMethodCallException in app/vendor/laravel/framework/src/Illuminate/Routing/Controller.php line 82 with the message:

Method [username] does not exist

I see the cause is from ThrottlesLogins. If I remove the Trait called ThrottlesLogins from my AuthController it will work.

The method [username] is from the ThrottlesLogins Trait at

protected function throttleKey(Request $request)
{
    return Str::lower($request->input($this->username())).'|'.$request->ip();
}
like image 893
Tudor-Radu Barbu Avatar asked Sep 07 '17 09:09

Tudor-Radu Barbu


1 Answers

The two default authentication controllers provided with the framework have been split into four smaller controllers. This change provides cleaner, more focused authentication controllers by default. The easiest way to upgrade your application to the new authentication controllers is to grab a fresh copy of each controller from GitHub and place them into your application.

You should also make sure that you are calling the Auth::routes() method in your routes/web.php file. This method will register the proper routes for the new authentication controllers.

Once these controllers have been placed into your application, you may need to re-implement any customizations you made to these controllers. For example, if you are customizing the authentication guard that is used for authentication, you may need to override the controller's guard method. You can examine each authentication controller's trait to determine which methods to override.

Upgrading laravel 5.2 to 5.3

like image 174
Vikas Rinvi Avatar answered Oct 04 '22 08:10

Vikas Rinvi