Question

I'm using Laravel (version 4) on a project of mine and I was wondering if it would be possíble in any way to know the verb to my requisition inside a laravel's controller.

Thanks in advance.

Was it helpful?

Solution

I don't know your exact Laravel version.

The current docs say there's a specific method in the Request object. Quoting:

$method = Request::method();

if (Request::isMethod('post'))
{
    //
}

but I don't have a 4.1 version to test with, though. In any case you can always access the $_SERVER superglobal - Laravel style, too:

echo Request::server('REQUEST_METHOD');
// will get you "GET", "POST", ecc.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top