public function handle($request, Closure $next, string $namespace)
    {
        /** Build and register the API. */
        $api = $this->bindApi($namespace, $request->getSchemeAndHttpHost() . $request->getBaseUrl());

        /** Substitute route bindings. */
        $this->substituteBindings($api);

        /** Set up the Laravel paginator to read from JSON API request instead */
        $this->bindPageResolver();

        return $next($request);
    }