I know this one
{{route('editApplication', ['id' => $application->id])}} == /application/edit/{id}
But I need
?? == /application/edit?appId=id
Anyone, please replace the "??" with your answer that helps me out.
I know this one
{{route('editApplication', ['id' => $application->id])}} == /application/edit/{id}
But I need
?? == /application/edit?appId=id
Anyone, please replace the "??" with your answer that helps me out.
It depends how you route looks like:
If you route is:
Route::get('/application/edit/{id}', 'SomeController')->name('editApplication');
when you use
route('editApplication', ['id' => 5])
url will be like this:
/application/edit/5
However all other parameters (that are not in route parameters) will be used as query string so for example:
route('editApplication', ['id' => 5, 'first' => 'foo', 'second' => 'bar'])
will generate url like this:
/application/edit/5?first=foo&second=bar
In case you want to achieve url like this
/application/edit?appId=id
you should define route like this:
Route::get('/application/edit/', 'SomeController')->name('editApplication');
and then when you use
route('editApplication', ['appId' => 5])
you will get
/application/edit?appId=5
url.
You need to modift your "editApplication" route without parameter option. If you stil want the parameter just add the following row in your controller and just catch the data by using;
$appId = $request->input('appId');
route
method accepts any set of variable and puts them as query string unless the variable name matches with defined route signature.
Thus, for your case you can do something as follows:
route('editApplication', ['appId' => <your id here>])
You can provide any number of variables with the array.
© 2022 - 2024 — McMap. All rights reserved.