Blade Directives
Laravel ACL supports the built-in function of Laravel's Authorization
directives like @can
and @cannot
.
@can($permission)
@can('posts.update') <!-- The Current User Can Update The Post -->@endcan
@cannot($permission)
@cannot('posts.update') <!-- The Current User Can't Update The Post -->@endcannot
Additional Directives
In addition to the built-in directives, Laravel ACL provides @canAtLeast
, @isRole
and @hasRole
directives:
@canAtLeast([$permissions])
@canAtLeast(['posts.update', 'posts.view']) <!-- The Current User Can Update or View The Post -->@endCanAtLeast
@role($roleSlug)
@role('administrator') <!-- The Current User is an Administrator -->@endRole
@hasRole($roleSlug)
@hasRole('administrator') <!-- The Current User have an administrator role -->@endHasRole