You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I feel like there should be a way to get a single value from either get or post explicitly. paramsGet() gives you the whole collection for get, and param() will give you a single value, but may not be the one you were looking for if there happens to be a get and post variable with the same name. So, right now, I'm just doing $post = $request->paramsPost()->all(); at the top and using $post just like $_POST, just somewhat less global.
The $request->param() and $request->params() methods are just convenience methods that merge together all of the possible parameter locations. As you said, the paramsGet() method gives you the entire collection object, but then you still get the very convenient API. Calling $request->paramsGet()->all() returns a raw PHP array (not very friendly to use), which essentially defeats the purpose of the collections all together. Instead use the collections as they're given to you:
I feel like there should be a way to get a single value from either get or post explicitly.
paramsGet()
gives you the whole collection for get, andparam()
will give you a single value, but may not be the one you were looking for if there happens to be a get and post variable with the same name. So, right now, I'm just doing$post = $request->paramsPost()->all();
at the top and using $post just like $_POST, just somewhat less global.If it could also somehow encapsulate/simplify php's
filter_input*
functionality, that could be pretty awesome. http://php.net/manual/en/function.filter-input-array.phpThe text was updated successfully, but these errors were encountered: