php - laravel FormBuilder getMethod issue

942

The getMethod function implementation does not accept all HTTP verbs exceptPOST,GET? My use case is this

  • Form open to an update resource, so method should bePUT.
  • I built one access control library to check if the user has access to the { resource, method }
  • I am usinggetMethod() to get method name, but it always returnsPOST even if the parameter sent isPUT.
  • As this is returningPOST always,ACL always returnsNO_ACCESS

Any reason whygetMethod() is written this way?

1

Answer

Solution:

First, I would check to make sure your web server allows PUT requests. I had an issue with the web server only allowing GET and POST by default.

I'm assuming you're doing something likeif( Request::getMethod() == 'POST' )?

Since laravel's Request class extends Symfony's you can try usingRequest::isMethod('post'). This is my preference and it reads better IMO.

People are also looking for solutions to the problem: php - Catching error messages and states from wp cron

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.