Laravel 4 - Blade Templating - How to properly Link to Route?

LoveAndHappiness picture LoveAndHappiness · Mar 31, 2014 · Viewed 51.2k times · Source

I want to create a resourceful link with Laravel. Normally I just use the {{ link_to_route('Yadayadayada.route', 'LinkName', $params }}

But in this case I am using a Template with this layout:

<a href="index.html">
     <i class="icon-dashboard"></i>
     <span class="menu-text"> Dashboard </span>
</a>

That means that inside the anchor tag, is as well a <i>-Tag and a <span>-Tag. Is it possible to use the {{ link_to_route }}-Method, without having to change the layout of the Template?

Answer

Joseph Silber picture Joseph Silber · Mar 31, 2014

Use URL::route() to get just a link:

<a href="{{ URL::route('user/profile/', $params) }}">
     <i class="icon-dashboard"></i>
     <span class="menu-text"> Dashboard </span>
</a>