DevMarketer / multiauth_tutorial

156 stars 83 forks source link

When Admin log out that time visible Admin log in page #3

Closed mostafa6765 closed 7 years ago

mostafa6765 commented 7 years ago

When AdminLog out the page redirect to home page.how can redirect admin log in page when admin log out.

liakat89 commented 7 years ago

login from two different browser one for user and another for admin and test again! hope it helps

cham11ng commented 7 years ago

Solution is to overwrite the logout function, Add following lines in AdminLoginController

class AdminLoginController extends Controller {
    //
    /**
     * Log the user out of the application.
     * Redirect to admin login page
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function logout(Request $request)
    {
        $this->guard()->logout();

        $request->session()->flush();

        $request->session()->regenerate();

        return redirect('/admin'); // default is 'redirect('/')'
    }
    //
}
jacurtis commented 7 years ago

Thank you for specifying that @cham11ng. That is the correct solution.

New video going live May 22 addresses creating a specific logout function exclusively for each type of user. In the video we add the redirect line and I leave it at the return redirect('/'); but of course you can always customize that route that you want to redirect, to be anything your application requires.

Code for the video has been updated and you can view the changelog here: https://github.com/DevMarketer/multiauth_tutorial/commit/558bc66d783841c724cc556679fa9218f184c3f2?diff=split