From 23d57927088b21a25c012687808ec85bfaba1592 Mon Sep 17 00:00:00 2001 From: erikn69 Date: Thu, 22 Aug 2024 12:16:08 -0500 Subject: [PATCH] Only show error if cache key exists and forgetCachedPermissions fail --- src/Commands/CacheReset.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Commands/CacheReset.php b/src/Commands/CacheReset.php index 180d16972..7cfc65ae7 100644 --- a/src/Commands/CacheReset.php +++ b/src/Commands/CacheReset.php @@ -13,9 +13,12 @@ class CacheReset extends Command public function handle() { - if (app(PermissionRegistrar::class)->forgetCachedPermissions()) { + $permissionRegistrar = app(PermissionRegistrar::class); + $cacheExists = $permissionRegistrar->getCacheRepository()->has($permissionRegistrar->cacheKey); + + if ($permissionRegistrar->forgetCachedPermissions()) { $this->info('Permission cache flushed.'); - } else { + } else if ($cacheExists) { $this->error('Unable to flush cache.'); } }