In a view, I want to create a link (generate the url) to a route. I believe this is called “reverse routing.” I want to add a query string to the generated url.
The target routes need to take a query string parameter to specify what kind of view to return, e.g. partial, basic, full. I will also be adding other query string params for search terms and fields. I will need to pass these on to my api that is called with my dispatcher (consuming my own api).
Route::get('thing/{id}', [
'uses' => 'path\to\namespace\ThingController@show',
'as' => 'thng.show']);
Route::get('thing/form/{id?}', [
'uses' => 'path\to\namespace\ThingController@form',
'as' => 'thng.form']);
In a view:
<td>{{ link_to_route('thng.show?filter="partial"', $row->title,
['id' => $row->id]) }}</td>
I tried simply appending ?string to the route name within link_to_route, but that doesn't work (Error = Route [lstg.show?filter="partial"] not defined). I'm not sure how to hard-code it either since it's a named route and does take a named route parameter.