admin/dashboard not defined on Redirectif Authenticated Route Error on lcoalhost\login

Posted 10 months ago by asad98iftikhar

This is mine RedirectifAuthenticated.php code

When i am Manually going to localhost/admin/dashbaord then its accessible after logging in if i remove this code but when i am writting this code then its not accessible

public function handle($request, Closure $next, $guard = null)
        {
            if (Auth::guard($guard)->check() && Auth::user()->role->id == 1) {
                return redirect()->route('admin.dashboard');
            }elseif(Auth::guard($guard)->check() && Auth::user()->role->id == 2){
                return redirect()->route('user.dashboard');
        }else
         {
            return $next($request);
         }
    }

} I have this code its gaving Error that route admin.dashboard not defined if i Mnaually go to route admin.dashbaord then its Accessible

l

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