From 7090824cca57e693b880ce3aaf7ef78362e28bbd Mon Sep 17 00:00:00 2001 From: Chris Brown Date: Wed, 25 Oct 2023 01:12:01 -0400 Subject: [PATCH] Merge doc updates --- docs/basic-usage/blade-directives.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/basic-usage/blade-directives.md b/docs/basic-usage/blade-directives.md index 51924866b..64e9273e8 100644 --- a/docs/basic-usage/blade-directives.md +++ b/docs/basic-usage/blade-directives.md @@ -5,7 +5,7 @@ weight: 7 ## Permissions This package doesn't add any **permission**-specific Blade directives. -Instead, use Laravel's native `@can` directive to check if a user has a certain permission. +Instead, use Laravel's native `@can` directive to check if a user has a certain permission (whether you gave them that permission directly or if you granted it indirectly via a role): ```php @can('edit articles') @@ -27,7 +27,7 @@ As discussed in the Best Practices section of the docs, **it is strongly recomme Additionally, if your reason for testing against Roles is for a Super-Admin, see the *Defining A Super-Admin* section of the docs. -If you actually need to test for Roles, this package offers some Blade directives to verify whether the currently logged in user has all or any of a given list of roles. +If you actually need to directly test for Roles, this package offers some Blade directives to verify whether the currently logged in user has all or any of a given list of roles. Optionally you can pass in the `guard` that the check will be performed on as a second argument. @@ -48,6 +48,12 @@ is the same as I am not a writer... @endhasrole ``` +which is also the same as +```php +@if(auth()->user()->hasRole('writer')) + // +@endif +``` Check for any role in a list: ```php