Created
November 24, 2013 17:24
-
-
Save elliotlings/7629783 to your computer and use it in GitHub Desktop.
Custom Laravel 4 asset function for static subdomain.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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