Laravel 4 - Bootstrap glyphicons
-
20-12-2019 - |
Question
Does anybody know how can I do to put a Bootstrap glyphicon
in my
{{ link_to_route('post.create', 'New' ) }}
I would like to show a glyphicon just before 'New', and I don't know how to do it.
Solution
Try this.
<a href="{{ route('post.create') }}">
<i class="glyphicon glyphicon-plus"></i>
<span>New</span>
</a>
OTHER TIPS
With a helper like this one:
function icon_link_to_route($icon, $route, $title = null, $parameters = array(), $attributes = array())
{
$url = route($route, $parameters);
$title = (is_null($title)) ? $url : e($title);
$attributes = HTML::attributes($attributes);
$title = '<span class="glyphicon glyphicon-'.e($icon).'"></span>' . $title;
return '<a href="'.$url.'"'.$attributes.'>'.$title.'</a>';
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow