title: Laravel 5 link_to_* with icon/html
body: <p>Anyone figured out how to put HTML inside $title parameter of link_to_* helper functions?</p>
  
  <p>I've been googling around and found some topics about it directly on <a href="http://laravel.io/forum/09-25-2014-how-to-get-font-awesome-icons-to-show-up-when-using-link-to-route" rel="nofollow">laravel.io</a> but there are only suggestions:</p>
  
  <ol>
  <li>make your own helper (tried but in the end I use link_to_* or <code>App::make('html')-&gt;linkRoute(...);</code> example <a href="http://laravelsnippets.com/snippets/helper-link-functions-with-font-awesome-icons" rel="nofollow">helpers</a>.</li>
  <li>generate links inside views and use URL facade</li>
  <li>Use HTML facade to encode links in views (I think this is not secure, do not know why just feels like it is wrong).</li>
  </ol>
  
  <p>To make myself clear I am asking <strong>how to make 1. suggestion work?</strong> (I tried helpers but result is the same when using L5 helper <code>link_to_route('some.route', 'This is title with icon &lt;i class="icon"&gt;&lt;/i&gt;');</code> and helper that I made (code below). Where <code>$icon = '&lt;i class="some-icon"&gt;&lt;/i&gt;';</code> </p>
  
  <p>
  
  <pre><code>if ( ! function_exists('link_to_route_icon'))
  {
  
      function link_to_route_icon($name, $title = null, $icon = null,  $parameters = array(), $attributes = array())
      {
          return app('html')-&gt;linkRoute($name, $title . $icon, $parameters, $attributes);
      } 
  }
  </code></pre>
  
  <p>both (my own helper or L5 helper) output the same result:</p>
  
  <ul>
  <li><p>visible in browser: <code>name&lt;i class="fa-sort-alpha-asc"&gt;&lt;/i&gt;</code></p></li>
  <li><p>html code: <code>&lt;a href="http://acme.dev/dashboard/users?order=desc&amp;amp;sort=name"&gt;name&amp;lt;i class="fa-sort-alpha-asc"&amp;gt;&amp;lt;/i&amp;gt;&lt;/a&gt;</code></p></li>
  </ul>
  
  <h1>Solution</h1>
  
  <pre><code>if ( ! function_exists('link_to_route_icon'))
  {
  
      function link_to_route_icon($name, $title = null, $icon = null, $parameters = array(), $attributes = array())
      {
          $url = route($name, $parameters);
  
          return '&lt;a href="' . $url . '"' . app('html')-&gt;attributes($attributes) . '&gt;' . htmlentities($title) . ' ' . $icon . '&lt;/a&gt;';
      }
  }
  </code></pre>
  
  <hr>
  
  <p>Please note when using L5 and you want to use your own helper.php, you have to load it in composer.json</p>
  
  <pre><code>"psr-4": {
      "App\\": "app/"
  },
  "files": [
      "app/Helpers.php"
  ]
  </code></pre>