Skip to content

Commit 05f620c

Browse files
committed
[Docs] Update to note Laravel 11.23 updates
1 parent a6cfb37 commit 05f620c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/basic-usage/enums.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ enum RolesEnum: string
4747

4848
## Creating Roles/Permissions using Enums
4949

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.
5151

5252
You must manually convert the name to its value in order to pass the correct string to Eloquent for the role/permission name.
5353

@@ -62,15 +62,15 @@ Same with creating Permissions.
6262

6363
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.
6464

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)).
6666

6767
Examples:
6868
```php
6969
// the following are identical because `hasPermissionTo` is aware of `BackedEnum` support:
7070
$user->hasPermissionTo(PermissionsEnum::VIEWPOSTS);
7171
$user->hasPermissionTo(PermissionsEnum::VIEWPOSTS->value);
7272

73-
// when calling Gate features, such as Model Policies, etc
73+
// when calling Gate features, such as Model Policies, etc, prior to Laravel v11.23.0
7474
$user->can(PermissionsEnum::VIEWPOSTS->value);
7575
$model->can(PermissionsEnum::VIEWPOSTS->value);
7676

0 commit comments

Comments
 (0)