Laravel-4 Empty PUT data sent to resourceful controller

G'day

I'm having problems with PUT requests made through the Chrome mail server to the controller, there is no PUT data, POST data is working fine.

I performed an update for the composer before making sure that the latest version of the vendor’s products, where bootstrap / compiled.php is available and even removed.

Does anyone have any other similar problems?

The update function indicating both section_id and the data in the response is empty:

public function update($id) { $section_id = Input::get('section_id'); $data = Input::all(); return Response::json(array('id' => $id, 'section_id' => $section_id, 'data' => $data)); } 

I completely debugged the code to ParameterBag.php, and the list of parameters this this β†’ request is empty, I'm not sure what should contain any values, but all the input values ​​through the code are empty. Not sure what to do now without using a post instead of put.

+7
source share
2 answers

PUT options do not work out of the box because PHP itself has some security restrictions around them. See: http://www.php.net/manual/en/features.file-upload.put-method.php

However, Laravel implements a general workaround for this.

In Postman (or your form, or curl or any other client that you use) just add the name of the URL parameter: value "_method": PUT

Example 1:? _method = PUT

Example 2: <input type = "hidden" name = "_ method" value = "PUT" />

Laravel uses the Symfony Http Foundation, which checks the _method variable and whether it indicates its routes based on its value instead of the HTTP method used.

+9
source

You should send a POST request with the addition of an additional _method parameter with a PUT value, and it will work fine.

+1
source

All Articles