Laravel route in bootstrap button

I want to make a button that links to a 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 works below, but generates a link, not a button.

{{ HTML::link('normindex','Left')}}

Does anyone have any ideas?

+4
source share
5 answers

Well, they don’t work, because it HTML::link()will output the full HTML link, and the second attempt just uses plain text in the attribute href, so Laravel does not know that it should include something there.


You can try the following:

 <button href="{{ route('normindex') }}" type="button" class="btn btn-default">Left</button>

route()helper will print the URL of the route you pass to it. This will require a named route in your file routes.php, for example:

Route::get('your-path', array('as' => 'normindex', function()
{
   // do stuff
}));
+4
source

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'));
+8

Shanaka , , , , .

:

{!! Html::linkRoute('posts.show','cancel',array($post->id),array('class' => 'btn btn-danger btn-block')) !!}
+2

Add button class from bootstrap to your route

{!! Html::linkRoute('posts.show','cancel',array($post->id),array('class=>'btn btn-danger btn-block')!!}
+1
source

Use the BTN class bootstrap tag:

Left

0
source

All Articles