I have a mess while laravel 5.4 to 7.9, I have read the follow document: https://laravel.com/docs/7.x/requests , but I am not clear in my case:
In laravel 5.4, it returns an array:
It's an emty array in laravel 7.9:
Thanks!
The problem you are describing is expected behaviour and was changed in between versions.
The only
method returns all of the key / value pairs that you request, even if the key is not present on the incoming request. When the key is not present on the request, the value will be null
.
The only
method returns all of the key / value pairs that you request; however, it will not return key / value pairs that are not present on the request.