Reputation: 591
In laravel i have link called ZOEKEN it goes to 'zoekenindex'. It works
<li> {{HTML::link('zoekenindex','ZOEKEN')}}</li>
But instead of a a link i want a button:
<button href="{{ route('zoekenindeze') }}" type="button" class="btn btn-default">Left</button>
this outputs: "Unable to generate a URL for the named route "zoekenindex" as such route does not exist."
I don't get why, because the route works when i use the link code.
Anyone got a idea why this is possible?
Upvotes: 2
Views: 7456
Reputation: 3790
Laravel 5
{!! HTML::linkRoute('admin.users.edit', $user->display_name, array($user->id), ['class' => 'btn btn-default']) !!}
Upvotes: 0
Reputation: 452
<button href="{{ url('zoekenindeze') }}" type="button" class="btn btn-default">Left</button>
and it will point to the zoekenindeze route
Upvotes: 0
Reputation: 12169
Laravel don't find any name route called zoekenindex
in your route file.
Create a name route:
Route::get('zoekenindex', array('as' => 'zoekenindex', 'uses' => 'yourController@index'))
Your button: bootstrap by default will create the button. don't worry about the link.
<a href="{{ URL::route('zoekenindex') }}" class="btn btn-default">Left</a>
Laravel helper:
{{ link_to_route('zoekenindex', 'Left', null, array('class' => 'btn btn-default')) }}
or, if you don't like to create a name route, use the following:
<a href="{{ URL::to('zoekenindex') }}" class="btn btn-default">Left</a>
Laravel helper:
{{ link_to('zoekenindex', 'Left', array('class' => 'btn btn-default')) }}
Upvotes: 8