I\'m working with Laravel 5 authentification system provided by default. After logging out, a user is redirected to the root page but I\'d like to change that. I managed to
If you don't provide the $redirectAfterLogout
attribute, it will use the default which is '/'
.
This logic can be found in this class: \vendor\laravel\framework\src\Illuminate\Foundation\Auth\AuthenticatesUsers.php
public function logout()
{
Auth::guard($this->getGuard())->logout();
return redirect(property_exists($this, 'redirectAfterLogout') ? $this->redirectAfterLogout : '/');
}
Having said that, just add this attribute in your AuthController:
protected $redirectAfterLogout = '/afterRedirectURL';