nam_co
1 year ago

RedirectIfAuthenticated not working

Posted 1 year ago by nam_co

HI, hope somebody can help me, when Im login and visit Im not being auto redirected to the specified page, hope somebody can help me

public function handle($request, Closure $next, $guard = null)
    {
        if (Auth::guard($guard)->check() AND session()->has('redirect')) {
            $redirect = session()->get('redirect');
            session()->forget('redirect');
            return redirect($redirect);
        }
        if (Auth::guard($guard)->check()) {
            return redirect('/user/favorites');
        }

        return $next($request);
    }

Appreciate the help

Please sign in or create an account to participate in this conversation.