You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/basic-usage/enums.md
+3-3
Original file line number
Diff line number
Diff line change
@@ -47,7 +47,7 @@ enum RolesEnum: string
47
47
48
48
## Creating Roles/Permissions using Enums
49
49
50
-
When creating roles/permissions, you cannot pass a Enum name directly, because Eloquent expects a string for the name.
50
+
When **creating** roles/permissions, you cannot pass an Enum name directly, because Eloquent expects a string for the name.
51
51
52
52
You must manually convert the name to its value in order to pass the correct string to Eloquent for the role/permission name.
53
53
@@ -62,15 +62,15 @@ Same with creating Permissions.
62
62
63
63
In your application code, when checking for authorization using features of this package, you can use `MyEnum::NAME` directly in most cases, without passing `->value` to convert to a string.
64
64
65
-
There will be times where you will need to manually fallback to adding `->value` (eg: `MyEnum::NAME->value`) when using features that aren't aware of Enum support. This will occur when you need to pass `string` values instead of an `Enum`, such as when interacting with Laravel's Gate via the `can()` methods/helpers (eg: `can`, `canAny`, etc).
65
+
There may occasionally be times where you will need to manually fallback to adding `->value` (eg: `MyEnum::NAME->value`) when using features that aren't aware of Enum support, such as when you need to pass `string` values instead of an `Enum` to a function that doesn't recognize Enums (Prior to Laravel v11.23.0 the framework didn't support Enums when interacting with Gate via the `can()` methods/helpers (eg: `can`, `canAny`, etc)).
66
66
67
67
Examples:
68
68
```php
69
69
// the following are identical because `hasPermissionTo` is aware of `BackedEnum` support:
0 commit comments