Skip to content

Commit

Permalink
[Docs] Create events.md
Browse files Browse the repository at this point in the history
  • Loading branch information
drbyte authored Feb 17, 2025
1 parent c528d29 commit 43a7ea2
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions docs/advanced-usage/events.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
title: Events
weight: 5
---

By default Events are not enabled, because not all apps need to fire events related to roles and permissions.

However, you may enable events by setting the `events_enabled => true` in `config/permission.php`

## Available Events

The following events are available since `v6.15.0`:

```
\Spatie\Permission\Events\RoleAttached::class
\Spatie\Permission\Events\RoleDetached::class
\Spatie\Permission\Events\PermissionAttached::class
\Spatie\Permission\Events\PermissionDetached::class
```
Note that the events can receive the role or permission details as a model ID or as an Eloquent record, or as an array or collection of ids or records. Be sure to inspect the parameter before acting on it.

0 comments on commit 43a7ea2

Please sign in to comment.