What is the difference between $request->get('name') and $request['name'] ?
1 answer
As far as I see, the documentation does not mention pro ->get(...) , but indicates ->input(...)
Here is what is written in the laravel source code:
This method belongs to Symfony HttpFoundation and is not usually needed when using Laravel.
And further:
Instead, you may use the "input" method.
In the documentation in the section Retrieving Input Via Dynamic Properties about the second method they write:
You may also have access to the
Illuminate\Http\Requestinstance. When using dynamic properties If it is not present, it will be in the route parameters.
|
->input()- n.osennij$request['name']or$request->name. With this option, nothing prevents to check the data too (it works through__get). But as far as source codes are visible in both cases, there is no verification, just access to the data. If we talk about the difference between input and dynamic properties, then input uses thedata_gethelperdata_getwhich uses point notation, input is searched first in request, then in query, and in dynamic properties as I wrote in the answer: first, in request, then in parameters route. - Ilya Zelenko