I'm trying to check if a parameter name is included in a specific url like this: http://127.0.0.1:8000/box?size[eq]=200
I want to retrieve the name "size[eq]" in my laravel controller but it keeps returning false.
This is the code I'm using:
public function index(Request $request)
{
dd($request->has("size[eq]"));
}
CodePudding user response:
That is an array named size
with an index named eq
. It isn't an actual string on the server side. Most of Laravel's functions use the "dot notation" for dealing with nested elements. So for what would be $requestData['size']['eq']
would be:
$request->has('size.eq');
If you want to retrieve that value you would also use "dot notation":
$request->input('size.eq');