Utworzono pomocnika Aktywów własną rękę.
Najpierw zdefiniować rodzaje aktywów i ścieżki w app/config/assets.php
:
return array(
/*
|--------------------------------------------------------------------------
| Assets paths
|--------------------------------------------------------------------------
|
| Location of all application assets, relative to the public folder,
| may be used together with absolute paths or with URLs.
|
*/
'images' => '/storage/images',
'css' => '/assets/css',
'img' => '/assets/img',
'js' => '/assets/js'
);
Wtedy rzeczywista Asset
klasa:
class Asset
{
private static function getUrl($type, $file)
{
return URL::to(Config::get('assets.' . $type) . '/' . $file);
}
public static function css($file)
{
return self::getUrl('css', $file);
}
public static function img($file)
{
return self::getUrl('img', $file);
}
public static function js($file)
{
return self::getUrl('js', $file);
}
}
Więc moim zdaniem mogę to zrobić, aby pokazać obraz:
{{ HTML::image(Asset::img('logo.png'), "My logo")) }}
Lubisz to, aby zaimplementować skrypt Java:
{{ HTML::script(Asset::js('my_script.js')) }}
To działa na mnie! – Kasthuriraajan