diff --git a/src/Illuminate/Foundation/Console/ConfigClearCommand.php b/src/Illuminate/Foundation/Console/ConfigClearCommand.php index 47a978244a1f..740a03dac4bb 100644 --- a/src/Illuminate/Foundation/Console/ConfigClearCommand.php +++ b/src/Illuminate/Foundation/Console/ConfigClearCommand.php @@ -50,8 +50,16 @@ public function __construct(Filesystem $files) */ public function handle() { - $this->files->delete($this->laravel->getCachedConfigPath()); + $cachedConfigPath = $this->laravel->getCachedConfigPath(); - $this->components->info('Configuration cache cleared successfully.'); + if ($this->files->exists($cachedConfigPath)) { + if ($this->files->delete($cachedConfigPath)) { + $this->components->info('Configuration cache cleared successfully.'); + } else { + $this->components->error('Failed to clear configuration cache.'); + } + } else { + $this->components->info('Configuration cache is not present.'); + } } } diff --git a/src/Illuminate/Foundation/Console/EventClearCommand.php b/src/Illuminate/Foundation/Console/EventClearCommand.php index 966a18bcc3b2..ee3b43f41518 100644 --- a/src/Illuminate/Foundation/Console/EventClearCommand.php +++ b/src/Illuminate/Foundation/Console/EventClearCommand.php @@ -52,8 +52,16 @@ public function __construct(Filesystem $files) */ public function handle() { - $this->files->delete($this->laravel->getCachedEventsPath()); + $cachedEventsPath = $this->laravel->getCachedEventsPath(); - $this->components->info('Cached events cleared successfully.'); + if ($this->files->exists($cachedEventsPath)) { + if ($this->files->delete($cachedEventsPath)) { + $this->components->info('Cached events cleared successfully.'); + } else { + $this->components->error('Failed to clear events cache.'); + } + } else { + $this->components->info('Events cache is not present.'); + } } } diff --git a/src/Illuminate/Foundation/Console/RouteClearCommand.php b/src/Illuminate/Foundation/Console/RouteClearCommand.php index c496b10e73fc..16673dd08b9a 100644 --- a/src/Illuminate/Foundation/Console/RouteClearCommand.php +++ b/src/Illuminate/Foundation/Console/RouteClearCommand.php @@ -50,8 +50,16 @@ public function __construct(Filesystem $files) */ public function handle() { - $this->files->delete($this->laravel->getCachedRoutesPath()); + $cachedRoutesPath = $this->laravel->getCachedRoutesPath(); - $this->components->info('Route cache cleared successfully.'); + if ($this->files->exists($cachedRoutesPath)) { + if ($this->files->delete($cachedRoutesPath)) { + $this->components->info('Route cache cleared successfully.'); + } else { + $this->components->error('Failed to clear route cache.'); + } + } else { + $this->components->info('Route cache is not present.'); + } } }