11.08.2017 Views

codebright

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

URL Generation 121<br />

However, in some situations you may not wish to use pretty URLs. However, if you were to try to<br />

link to an asset using the helpers mentioned in the previous subchapter, then the index.php portion<br />

of the URL would be included, and the asset links would break.<br />

Even with pretty URLs, we don’t want to link to our assets using relative URLs because our routing<br />

segments will be confused for a folder structure.<br />

As always, Laravel, and Taylor, are one step ahead of us. Helpers are provided to generate absolute<br />

URLs to our assets. Let’s take a look at some of these helpers.<br />

First we have the URL::asset() method, let’s take a look at it in action. The first parameter to the<br />

method is the relative path to the asset.<br />

1

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!