使用 Laravel 5.1 注销
Logging out with Laravel 5.1
我已经使用 Laravel 5.1 3 天了,今天我遇到了一个小包块。我正在尝试注销经过身份验证的用户,但我得到:
BadMethodCallException in Controller.php line 283: Method [getLogout]
does not exist.
在AuthController.php中我说:
public function getLogout() {
parent::getLogout();
Auth::logout();
}
在routes.php
Route::get('auth/logout', 'Auth\AuthController@getLogout');
这是 welcome.blade.php
中的 HTML
<a href="auth/logout">Logout</a>
我做错了什么?
getLogout
is a method on the AuthenticatesUsers
trait,不在您控制器的父级上。
完全删除您的 getLogout
方法,一切都会按预期工作。
我已经使用 Laravel 5.1 3 天了,今天我遇到了一个小包块。我正在尝试注销经过身份验证的用户,但我得到:
BadMethodCallException in Controller.php line 283: Method [getLogout] does not exist.
在AuthController.php中我说:
public function getLogout() {
parent::getLogout();
Auth::logout();
}
在routes.php
Route::get('auth/logout', 'Auth\AuthController@getLogout');
这是 welcome.blade.php
中的 HTML<a href="auth/logout">Logout</a>
我做错了什么?
getLogout
is a method on the AuthenticatesUsers
trait,不在您控制器的父级上。
完全删除您的 getLogout
方法,一切都会按预期工作。