/** * Will return the request's data as an array from whatever source it can find. * Can be called in child classes to modify the contents of the data before saving. * @param Request $request * @return array */ protected function getPutData(Request $request) { if (!isset($this->putData)) { $body = $request->Body; $putVars = $request->Put(); if (isset($putVars['model'])) { $this->putData = json_decode($putVars['model'], true); } elseif (!empty($putVars)) { $this->putData = $putVars; } elseif (strlen($body) > 0) { $this->putData = json_decode($body, true); } else { $this->putData = []; } } return $this->putData; }