I have defined the following route:
Route::get('/tours/{country_identifier}', ['as' => 'country', 'uses' => 'CountryController@index']);
Now I would like to link to this named route using something like
route('country')
with a parameter for {country_identifier} filled in, e.g. '/tours/Canada'.
How can I make this happen?
You can pass the parameters as second argument array:
route('country', ['country_identifier' => $someValue]);
You can take a look at the documentation, there are a lot of useful examples there :)
To link from a view use (assuming you use blade)
<a href="{{ URL::route('country', array('country_identifier' => $var)) }}">$var</a>
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