April 14, 2018 —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.
The signature of the secure_asset
function is:
1function secure_asset(2 $path3);
The following function calls are equivalent:
1// https://laravel.artisan/js/application.min.js2secure_asset('js/application.min.js');3 4asset('js/application.min.js');
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.js13asset(14 'http://laravel.developer/js/application.min.js'15);
∎
The following amazing people help support this site and my open source projects ♥️
If you're interesting in supporting my work and want to show up on this list, check out my GitHub Sponsors Profile.