Skip to content

Commit

Permalink
Save and delete section - #20
Browse files Browse the repository at this point in the history
  • Loading branch information
DivineOmega committed Aug 31, 2015
1 parent 18a0b86 commit a2cf107
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,36 @@ foreach ($components as $component) {

See the [official Cachet documentation](https://docs.cachethq.io/docs) for information on the variables available for each type of Cachet element.

## Updating Cachet elements

The cachet.php allows you to make changes to a Cachet element and saving those changes back to your Cachet install. This is done by directly changing the Cachet element's public member variables, and then calling the object's `save()` method.

The following example shows how to change the name and status of a component, then save the changes.

```php
// Get components
$components = $cachetInstance->getAllComponents();

// Change component details
$component[0]->name = 'My awesome component';
$component[0]->status = 1;
$component[0]->save();
```

## Deleting Cachet elements

To delete a Cachet element from your Cachet install, you simply need to call the `delete()` method on the appropriate Cachet element object.

For example, to delete an incident you could do the following.

```php
// Get incidents
$incidents = $cachetInstance->getAllIncidents();

// Delete the first one
$incidents[0]->delete();
```

# Features

* Checking if Cachet instance is working correctly (via [ping](https://docs.cachethq.io/v1.0/docs/ping))
Expand Down

0 comments on commit a2cf107

Please sign in to comment.