hasRole('Superuser'); } } if (! function_exists('hasRole')) { /** * Check if the current authenticated user has the specified role. */ function hasRole(string $role): bool { return Auth::check() && Auth::user()->hasRole($role); } } if (! function_exists('hasAnyRole')) { /** * Check if the current authenticated user has any of the specified roles. */ function hasAnyRole(array $roles): bool { return Auth::check() && Auth::user()->hasAnyRole($roles); } }