Zendesk\API\Traits\Resource\Update::update PHP Method

update() public method

Update a resource
public update ( integer $id = null, array $updateResourceFields = [], string $routeKey = __FUNCTION__ ) : null | stdClass
$id integer
$updateResourceFields array
$routeKey string
return null | stdClass
    public function update($id = null, array $updateResourceFields = [], $routeKey = __FUNCTION__)
    {
        $class = get_class($this);
        if (empty($id)) {
            $id = $this->getChainedParameter($class);
        }
        try {
            $route = $this->getRoute($routeKey, ['id' => $id]);
        } catch (RouteException $e) {
            if (!isset($this->resourceName)) {
                $this->resourceName = $this->getResourceNameFromClass();
            }
            $this->setRoute(__FUNCTION__, $this->resourceName . '/{id}.json');
            $route = $this->resourceName . '/' . $id . '.json';
        }
        return $this->client->put($route, [$this->objectName => $updateResourceFields]);
    }
Update