Search code examples
phphtmllaravellaravel-4laravel-blade

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


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?


Solution

  • 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>