By John Koster
The secure_asset
function will return a URI composed of the application's URI and the given $path
. It internally makes a call to the asset
helper function and always passes true
as the argument for the $secure
parameter.
#Signature
The signature of the secure_asset
function is:
1function secure_asset(
2 $path
3);
#Example Use
The following function calls are equivalent:
1// https://laravel.artisan/js/application.min.js
2secure_asset('js/application.min.js');
3
4asset('js/application.min.js');
#Notes on asset
and secure_asset
If the supplied $path
to asset
and secure_asset
contains a protocol, that protocol is used regardless of what function or flags are set. For example, if a URI with the http://
protocol is supplied to the secure_asset
function, the resulting URI will contain the http://
protocol. In addition, if a domain name is supplied to either of the functions, that domain name will be used instead of the domain present in the request.
1// https://laravel.artisan/js/application.min.js
2asset(
3 'https://laravel.artisan/js/application.min.js',
4 false
5);
6
7// http://laravel.artisan/js/application.min.js
8secure_asset(
9 'http://laravel.artisan/js/application.min.js'
10);
11
12// http://laravel.developer/js/application.min.js
13asset(
14 'http://laravel.developer/js/application.min.js'
15);
∎