Hi, there's no difference between them, they do exactly the same thing.
request() - is a helper function ( wrapper function ) , open vendor/laravel/framework/src/Illuminate/Foundation/helpers.php - to see others
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I'm watching the Laravel 5.7 From Scratch series, and for handling requests in some way, I mostly see request() used.
The Laravel documentation seems to mostly type hint Request $request into whatever method is called, like this:
public function update(Request $request, $id)
{
$request->all();
}
To me, it seems convenient to just use request() instead since you don't need to pass it as a parameter, so something like:
public function update($id)
{
request()->all();
}
It seems like it does the exact same thing looking at the docs. Is that true? Is there a difference that I'm not aware of? Is it better to use one over the other?
Here is the request() helper method I'm talking about: https://laravel.com/docs/5.7/helpers#method-request
Thanks :)
Hi, there's no difference between them, they do exactly the same thing.
request() - is a helper function ( wrapper function ) , open vendor/laravel/framework/src/Illuminate/Foundation/helpers.php - to see others
Please or to participate in this conversation.