Skip to content

Commit 78122ea

Browse files
authored
Only show error if cache key exists and forgetCachedPermissions fail (#2707)
1 parent 44083f4 commit 78122ea

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Commands/CacheReset.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,12 @@ class CacheReset extends Command
1313

1414
public function handle()
1515
{
16-
if (app(PermissionRegistrar::class)->forgetCachedPermissions()) {
16+
$permissionRegistrar = app(PermissionRegistrar::class);
17+
$cacheExists = $permissionRegistrar->getCacheRepository()->has($permissionRegistrar->cacheKey);
18+
19+
if ($permissionRegistrar->forgetCachedPermissions()) {
1720
$this->info('Permission cache flushed.');
18-
} else {
21+
} else if ($cacheExists) {
1922
$this->error('Unable to flush cache.');
2023
}
2124
}

0 commit comments

Comments
 (0)