Skip to content

Commit

Permalink
Blade Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
erikn69 authored Feb 29, 2024
1 parent c64836a commit baf9beb
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/PermissionServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,8 @@ public static function bladeMethodWrapper($method, $role, $guard = null): bool
return auth($guard)->check() && auth($guard)->user()->{$method}($role);
}

protected function registerBladeExtensions($bladeCompiler): void
protected function registerBladeExtensions(BladeCompiler $bladeCompiler): void
{
/** @var BladeCompiler $bladeCompiler */
$bladeMethodWrapper = '\\Spatie\\Permission\\PermissionServiceProvider::bladeMethodWrapper';

// permission checks
Expand All @@ -134,7 +133,6 @@ protected function registerBladeExtensions($bladeCompiler): void
$bladeCompiler->if('role', fn ($args) => $bladeMethodWrapper('hasRole', $args));
$bladeCompiler->if('hasrole', fn ($args) => $bladeMethodWrapper('hasRole', $args));
$bladeCompiler->if('hasanyrole', fn ($args) => $bladeMethodWrapper('hasAnyRole', $args));
$bladeCompiler->if('hasanyrole', fn ($args) => $bladeMethodWrapper('hasAnyRole', $args));
$bladeCompiler->if('hasallroles', fn ($args) => $bladeMethodWrapper('hasAllRoles', $args));
$bladeCompiler->if('hasexactroles', fn ($args) => $bladeMethodWrapper('hasExactRoles', $args));
}
Expand Down

0 comments on commit baf9beb

Please sign in to comment.