Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
cjmellor authored Feb 28, 2024
1 parent 1195647 commit bf75908
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,21 @@ Approval::find(1)->approve(persist: false);

If you need to roll back an approval, you can use the `rollback` method.

> [!NOTE]
> By default, a Rollback will bypass been added back to the `approvals` table
```php
Approval::first()->rollback();
```

This will revert the data and set the state to `pending` and touch the `rolled_back_at` timestamp, so you have a record of when it was rolled back.

If you want a Rollback to be re-approved, pass the `bypass` parameter as `false` to the `rollback` method

```php
Approval::first()->rollback(bypass: false); // default is true
```

### Conditional Rollbacks

A roll-back can be conditional, so you can roll back an approval if a condition is met.
Expand Down

0 comments on commit bf75908

Please sign in to comment.