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');