Support the ongoing development of Laravel.io →
Forms

The getMethod function implementation does not accept all HTTP verbs except POST, GET?

My use case is this

  • Form open to an update resource, so method should be PUT.
  • I built one access control library to check if the user has access to the { resource, method }
  • I am using getMethod() to get method name, but it always returns POST even if the parameter sent is PUT.
  • As this is returning POST always, ACL always returns NO_ACCESS

Any reason why getMethod() is written this way?

Last updated 3 years ago.
0

Browsers only support GET and POST requests through form submissions.
The form method will always be one of those and is currently impossible for it to be anything else.
This is a limitation in browsers and not with Laravel of even PHP.

I believe you can fake a PUT or DELETE by adding a hidden form element the the name "_method" and the value of the method you want to fake.

<input type="hidden" name="_method" value="PUT">

The request will still be made over GET or POST but the getMethod should return the one from the hidden field.

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

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.