protected function mapForBrowser(Router $router, $routes, $applyAlwaysAuthenticate)
    {
        $middleware = [
            EncryptCookies::class,
            AddQueuedCookiesToResponse::class,
            StartSession::class,
            ShareErrorsFromSession::class,
            VerifyCsrfToken::class,
            SubstituteBindings::class,
        ];

        if ($applyAlwaysAuthenticate && !$this->isWhiteListedAuthRoute($routes)) {
            $middleware[] = Authenticate::class;
        }

        $router->group(['middleware' => $middleware], function (Router $router) use ($routes) {
            $routes->map($router);
        });
    }