I want to make a button that links to route: normindex
This blow does not seem to work.
<button href={{ HTML::link('normindex')}} type="button" class="btn btn-default">Left</button>
<button href="normindex" type="button" class="btn btn-default">Left</button>
This below does work but generates a link, not a button.
{{ HTML::link('normindex','Left')}}
Does anyone have any idea?
Try the following:
<a href="{{ URL::route('normindex') }}" class="btn btn-default"> Norm Index </a>
or
link_to_route('normindex', 'Norm Index', null, array('class' => 'btn btn-default'));
Well, they don't work because HTML::link()
will output a full HTML link, while your second attempt just uses plain text in the href
attribute, so there is no way for Laravel to know that it needs to include something in there.
You can try this:
<button href="{{ route('normindex') }}" type="button" class="btn btn-default">Left</button>
The route()
helper will print the URL of the route that you pass to it. This will need a named route in your routes.php
file, such as:
Route::get('your-path', array('as' => 'normindex', function()
{
// do stuff
}));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With