Skip to content

Instantly share code, notes, and snippets.

@elliotlings
Created November 24, 2013 17:24
Show Gist options
  • Save elliotlings/7629783 to your computer and use it in GitHub Desktop.
Save elliotlings/7629783 to your computer and use it in GitHub Desktop.
Custom Laravel 4 asset function for static subdomain.
<?php
function asset($path, $secure = null)
{
if (app('url')->isValidUrl($path)) return $path;
if (is_null($secure))
{
$scheme = app('url')->getRequest()->getScheme($secure) . '://';
}
else
{
$scheme = $secure ? 'https://' : 'http://';
}
return $scheme . 'assets.' . app('url')->getRequest()->getHost() . '/' . $path;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment