I've defined a route in web.php that looks like this:
Route::delete('/app/charges-for-order/{orderId}', 'AppController@deleteOrderCharges');
It seems to work well apart from when orderId
has a forward slash in it. Eg 11/11
.
Naturally my first port of call was to generate the url in the frontend using encodeURIComponent
:
/app/charges-for-order/${encodeURIComponent(orderId)}
(in javascript)
Which produces the url /app/charges-for-order/11%2F11
, replacing the forward slash with %2F
-- however, this is giving me a 404, as if Laravel is still seeing %2F as a forward slash for routing purposes.
How can I allow orderId
to have (encoded) forward slashes and still be part of the URL like that? Is there some alternate encoding scheme that Laravel will respect in this context?