When you are ready to place the links to the registered assets on your view, you may use the styles or scripts methods:
<head> <?php echo Asset::styles(); ?> <?php echo Asset::scripts(); ?> </head>
Sometimes you may need to specify that an asset has dependencies. This means that the asset requires other assets to be declared in your view before it can be declared. Managing asset dependencies couldn't be easier in Laravel. Remember the "names" you gave to your assets? You can pass them as the third parameter to the add method to declare dependencies:
Asset::add('jquery-ui', 'js/jquery-ui.js', 'jquery');
In this example, we are registering the jquery-ui asset, as well as specifying that it is dependent on the jquery asset. Now, when you place the asset links on your views, the jQuery asset will always be declared before the jQuery UI asset. Need to declare more than one dependency? No problem:
Asset::add('jquery-ui', 'js/jquery-ui.js', array('first', 'second'));
Before learning how to conveniently add and dump bundle assets, you may wish to read the documentation on creating and publishing bundle assets.
When registering assets, the paths are typically relative to the public directory. However, this is inconvenient when dealing with bundle assets, since they live in the public/bundles directory. But, remember, Laravel is here to make your life easier. So, it is simple to specify the bundle which the Asset container is managing.
Now, when you add an asset, you can use paths relative to the bundle's public directory. Laravel will automatically generate the correct full paths.