Laravel request handling inconsistencies #53737
Unanswered
macropay-solutions
asked this question in
General
Replies: 1 comment 4 replies
-
Furthermore, |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We know that laravel community says $request->input( should be used instead of $request->get(
The get returns results from the route params if exists and if not, only then goes to query and then to request InputBag.
The input returns from input source + query params, input source being only json or query or request InputBag.
The offsetUnset removes the key only from the InputBag that the input function uses. This leads to unpredictable results when you send a PUT request as json and also put query string in the url.
Same is valid for replace function.
To fix these we had to create 2 macros: https://github.com/macropay-solutions/laravel-crud-wizard-free/blob/39035ec6e4066a3f051455c061b861d4b592c345/src/Providers/CrudProvider.php#L42
UPDATE: we updated the macros.
NOTE:
$request->all() returns from InputBag (which is json or query or request) + query + files.
We write this here as FYI.
Beta Was this translation helpful? Give feedback.
All reactions