Reputation: 45
I've been using Laravel 5.1 for 3 days and today I faced an obsticle. I'm trying to logout the authenticated user but I get:
BadMethodCallException in Controller.php line 283: Method [getLogout] does not exist.
In AuthController.php I put that:
public function getLogout() {
parent::getLogout();
Auth::logout();
}
In routes.php
Route::get('auth/logout', 'Auth\AuthController@getLogout');
And this is the HTML in welcome.blade.php
<a href="auth/logout">Logout</a>
What am I doing wrong?
Upvotes: 0
Views: 1311
Reputation: 220026
getLogout
is a method on the AuthenticatesUsers
trait, not on your controller's parent.
Remove your getLogout
method entirely and everything should work as expected.
Upvotes: 4