Support the ongoing development of Laravel.io →
posted 11 years ago
Requests

Laravel documentation says I can use

$method = Request::method();

to get request method (POST, GET, etc.), but it throws "Call to undefined method Illuminate\Http\Request::method()"

Looking at Illuminate\Http\Request there is no method() function, but SymfonyRequest, that Laravel's Request extends, has getMethod() function, so this works just fine:

$method = Request::getMethod();

Questions:

  1. Is this a mistake in Laravel documentation?
  2. Is it safe to use Request::getMethod()?
Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

arnaslu arnaslu Joined 7 Apr 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.