validate($request); $user = $this->getUser($request); if (!Authority::canEditAdmissionRules($user)) { throw new AuthorizationFailedException(); } [$type, $id] = explode('_', $args['id']); $rule = \AdmissionRule::getRule($type, $id); if (!$rule) { throw new RecordNotFoundException(); } $payload = self::arrayGet($json, 'data.attributes.payload'); $rule->setAllData($payload); $rule->store(); return $this->getContentResponse($rule); } protected function validateResourceDocument($json, $data) { if (!self::arrayHas($json, 'data')) { return 'Missing `data` member at document“s top level.'; } if (!self::arrayHas($json, 'data.attributes')) { return 'Missing `attributes` member of data block.'; } if (!self::arrayHas($json, 'data.attributes.payload')) { return 'Missing `payload` member of attributes block.'; } } }