The asset function generates a URL for an asset using the current scheme of the request (HTTP or HTTPS):
<?php $url = asset('img/photo.jpg');
<?php     function secure_asset($path)

    {

        return asset($path, true);

    }

}
<?php     protected function assetPath($path, $secure = null)

    {

        return ($this->assetPathResolver ?? asset(...))($path, $secure);

    }