Skip to content

Commit

Permalink
docs: add new method example
Browse files Browse the repository at this point in the history
  • Loading branch information
cjmellor committed Nov 10, 2024
1 parent df53e2a commit 5751103
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,18 @@ Achievement::create([
]);
```

### Revoke Achievement

You can revoke an achievement from a user using the `revokeAchievement` method:

```php
$user->revokeAchievement($achievement);
```

The method will throw an exception if you try to revoke an achievement that the user doesn't have. You can revoke both standard and secret achievements, and it will also remove any associated progress.

When an achievement is revoked, a `AchievementRevoked` event is dispatched.

### Gain Achievement

To use Achievements in your User model, you must first add the Trait.
Expand Down Expand Up @@ -478,6 +490,13 @@ public Model $user,
> [!NOTE]
> This event only runs if the progress of the Achievement is 100%
**AchievementRevoked** - When an Achievement is detached from the User

```php
public Achievement $achievement,
public Model $user,
```

**AchievementProgressionIncreased** - When a Users’ progression for an Achievement is increased.

```php
Expand Down

0 comments on commit 5751103

Please sign in to comment.