1. 修改ROUTE
// Authentication routes... Route::get('login', 'Auth\AuthController@getLogin'); Route::post('login', 'Auth\AuthController@postLogin'); Route::get('logout', 'Auth\AuthController@getLogout'); // Registration routes... Route::get('register', 'Auth\AuthController@getRegister'); Route::post('register', 'Auth\AuthController@postRegister');
2.AuthController添加字段
protected $redirectPath = '/page'; //PasswordController中也要添加此项,在更改密码后跳转 protected $loginPath = '/login'; protected $redirectAfterLogout = '/page'; protected $username = 'name';
3.修改MiddleWare下的Authenticate与RedirectIfAuthenticated
class Authenticate { ... public function handle($request, Closure $next) { ... } else { return redirect()->guest('login'); //修改这里!
class RedirectIfAuthenticated { public function handle($request, Closure $next) { if ($this->auth->check()) { return redirect('/'); //修改这里!