I have the following endpoint
Route::prefix('traffic-table')->group(function() {
Route::delete('/{id_olt}', 'Api\TrafficTableController@remove');
});
And I want to obtain the request parameters like this:
public function remove($id_olt, Request $request)
{
return response()->json($request->all());
}
which return an empty array.Here is my curl call:
curl --location --request DELETE 'localhost/api/traffic-table/41' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer 2|jY4c7vBFTTG9Jb0cW1NAgm6Kr0gTFLeJO9t9Nu8I' \
--form 'id="1010"'
How could I obtain the id (besides sending it through the url)
CodePudding user response:
Instead of using --form, try using the following
--data "id=1010"
Then you can use $request->input('id')
to retrieve it.
Let me know how you go.