Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

nanadjei2's avatar

Multi Auth not displaying my whoops page

Am doing a multi auth with laravel 5.5. The admin middleware works fine but when I get an error the error page (whoops) does not display.

This is my Handler.php

  public function render($request, Exception $exception)
    {

      $guard = array_get($exception->guards(), 0);
      switch ($guard) {
        case 'admin':
            $login = 'admin.login';
            return redirect()->guest(route($login));
           
        default:
            
            return parent::render($request, $exception);

       
      }
    // return parent::render($request, $exception);
  }

This is my RedirectIfAuthenticated Middleware

       public function handle($request, Closure $next, $guard = null)
           {
    
          switch ($guard) {
          case 'admin':
            if (Auth::guard($guard)->check()) {
                return redirect()->route('admin.dashboard');
            }
        break;
        
        default:
            if (Auth::guard($guard)->check()) {

                return redirect('/home');
             }
           break;
       }

       return $next($request);
    }
0 likes
0 replies

Please or to participate in this conversation.