laravel - Add twitter bootstrap icon to linkRoute -
wondering how add icon linkroute.
{{ html::linkroute('edit_data', 'edit', $data->id) }}
i want edit show:
<span class="glyphicon glyphicon-edit"></span>
i tried this, didn't work:
{{ html::linkroute('edit_data', '<span class="glyphicon glyphicon-edit"></span>', $data->id) }}
this won't work , can use html
tags instead of function or create custom macro this:
html::macro('ilinkroute', function($name, $title = null, $parameters = array(), $attributes = array(), $html = ''){ $url = route($name, $parameters); if (is_null($title) || $title === false) $title = $url; return "<a href = '$url'>$html.$title</a>" ; });
then use this:
{{ html::ilinkroute('user.show.profile', 'profile', ['username' => 'heera'], [] , '<span class="glyphicon glyphicon-edit"></span>') }}
the generated output:
<a href="http://blog.dev/user/heera"><span class="glyphicon glyphicon-edit"></span>.profile</a>
you may keep macro
in filters.php
or create file macros.php
, add file using require
within app/starts/global.php
file, add require @ end of global.php
:
require '/macros.php';
Comments
Post a Comment