public static function toAsset($url, $https = null)
    {
        if (static::valid($url) || static::valid('http:' . $url)) {
            return $url;
        }

        $app = Config::get('app');
        $root = ($app['asset_url'] != '') ? $app['asset_url'] : false;

        // shoot us through a different server or third-party content delivery network.
        if ($root) {
            return rtrim($root, '/') . '/' . ltrim($url, '/');
        }

        $url = static::to($url, $https, true);

        // we do not need to come through the front controller.
        if ($app['index'] !== '') {
            $url = str_replace($app['index'] . '/', '', $url);
        }

        return $url;
    }