Welcome Guest, Not a member yet? Register   Sign In
HOW to use PUT with ResourceController?
#1

(This post was last modified: 12-15-2020, 08:45 AM by blaasvaer.)

OK, this has been driving me absolutely nuts for a day now.

Can someone please explain to me HOW I could send a PUT request and have it accept an ID and DATA in json-format?

WHAT would the route look like?

WHAT would the update method look like – WHAT parameters does it need in order to JUST WORK with the "built in" update method on the Model (as is claimed in the docs)?

HOW would I SEND the data to the Model in the right format ($request->getRawInput() is of no use at all)?

I simply cannot find this information in a clear an understandable way in the docs, or online for that matter.

Code:
ROUTE: $routes->put('api/(:segment )/(:any)', 'Api::update/$1/$2');


Controller method update:


Code:
public function update ($resource = null, $id = null)
{
    $data = $this->request->getRawInput();
    $this->model->update($id, $data);
}
Reply


Messages In This Thread
HOW to use PUT with ResourceController? - by blaasvaer - 12-15-2020, 08:44 AM



Theme © iAndrew 2016 - Forum software by © MyBB