protected function fixLinks($result)
    {
        if (false === $this->replaceLinks) {
            return $result;
        }

        $isArray = false;
        $string = '';
        if (is_array($result)) {
            $string = json_encode($result, JSON_UNESCAPED_SLASHES);
            $isArray = true;
        } elseif (is_string($result)) {
            $string = $result;
        }

        $myUri = Environment::getURI();

        $allRws = Service::whereType('rws')->whereIsActive(1)->get()->all();
        if (!empty($allRws)) {
            /** @var Service $rws */
            foreach ($allRws as $rws) {
                $config = $rws->getConfigAttribute();
                $baseUrl = trim(array_get($config, 'base_url'), '/');
                $dfUrl = trim($myUri, '/') . '/api/v2/' . $rws->name;
                $string = str_replace($baseUrl, $dfUrl, $string);
            }
        }

        return ($isArray) ? json_decode($string, true) : $string;
    }
protected function fixLinks($result)
    {
        if (false === $this->replaceLinks) {
            return $result;
        }

        $isArray = false;
        $string = '';
        if (is_array($result)) {
            $string = json_encode($result, JSON_UNESCAPED_SLASHES);
            $isArray = true;
        } elseif (is_string($result)) {
            $string = $result;
        }

        $myUri = Environment::getURI();

        $allRws = Service::whereType('rws')->whereIsActive(1)->get()->all();
        if (!empty($allRws)) {
            /** @var Service $rws */
            foreach ($allRws as $rws) {
                $config = $rws->getConfigAttribute();
                $baseUrl = trim(array_get($config, 'base_url'), '/');
                $dfUrl = trim($myUri, '/') . '/api/v2/' . $rws->name;
                $string = str_replace($baseUrl, $dfUrl, $string);
            }
        }

        return ($isArray) ? json_decode($string, true) : $string;
    }
protected function fixLinks ( $ result ) { if ( false === $ this -> replaceLinks ) { return $ result ; } $ isArray = false ; $ string = '' ; if ( is_array ( $ result ) ) { $ string = json_encode ( $ result , JSON_UNESCAPED_SLASHES ) ; $ isArray = true ; } elseif ( is_string ( $ result ) ) { $ string = $ result ; } $ myUri = Environment :: getURI ( ) ; $ allRws = Service :: whereType ( 'rws' ) -> whereIsActive ( 1 ) -> get ( ) -> all ( ) ; if ( ! empty ( $ allRws ) ) { /** @var Service $rws */ foreach ( $ allRws as $ rws ) { $ config = $ rws -> getConfigAttribute ( ) ; $ baseUrl = trim ( array_get ( $ config , 'base_url' ) , '/' ) ; $ dfUrl = trim ( $ myUri , '/' ) . '/api/v2/' . $ rws -> name ; $ string = str_replace ( $ baseUrl , $ dfUrl , $ string ) ; } } return ( $ isArray ) ? json_decode ( $ string , true ) : $ string ; }
Replaces any hyper links referencing any DF remote web service's base url
with the link to the corresponding DF service itself to ensure DF rws works
as the gateway to all remote service calls.

@param $result

@return mixed
Replaces any hyper links referencing any DF remote web service s base url with the link to the corresponding DF service itself to ensure DF rws works as the gateway to all remote service calls .