Edit : see later, my projects are now with the same Laravel version 9.26.1.
I have two laravel/vue.js projects. One with Laravel 9.2 et the second with Laravel 9.11. NO SEE edit above.
I got a difference using $request→mykey and $request→get(‘mykey’).
The data send by vues.js (axios) have the same structure.
I dumped $request at the beginning of my controller and found some differences (see below) that explain the problem but I don’t undertand why these differences. For now I cannot make the two projects with the same version, so I would like to understand how $request is build inside Laravel.
2 main differences
- mykey is not present in the « InputBag »
- json return ParamaterBag (Projet 1) et InputBag (Projet2)
Projet 1 (Laravel 9.2)
Illuminate\Http\Request^ {#46
+attributes: Symfony\Component\HttpFoundation\ParameterBag^ {#48
#parameters: []
}
+request: Symfony\Component\HttpFoundation\InputBag^ {#38
#parameters: array:7 [
… // mykey not present
]
}
…
-isForwardedValid: true
#json: Symfony\Component\HttpFoundation\ParameterBag^ {#45
#parameters: array:10 [
...
"mykey" => "1" // my key present here
]
}
#convertedFiles: []
...
Projet 2 (Laravel 9.11)
Illuminate\Http\Request^ {#44
+attributes: Symfony\Component\HttpFoundation\ParameterBag^ {#46
#parameters: []
}
+request: Symfony\Component\HttpFoundation\InputBag^ {#36
#parameters: array:10 [
….
"mykey" => 1
]
}
…
-isForwardedValid: true
#json: Symfony\Component\HttpFoundation\InputBag^ {#36}
#convertedFiles: []
...
How can we explain these differences ?
How $request is build inside Laravel ?
Thanks in advance for any help.