Add clear caches command to laravel

This commit is contained in:
Afiq Hamzah
2024-08-08 12:40:42 +08:00
parent 0b765271f9
commit 2c859ac3b5
+41
View File
@@ -0,0 +1,41 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class ClearAllCaches extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'clear-caches';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Clear all caches in the application';
/**
* Execute the console command.
*/
public function handle()
{
$this->callSilent('config:clear');
$this->callSilent('cache:clear');
$this->callSilent('event:clear');
$this->callSilent('route:clear');
$this->callSilent('view:clear');
$this->callSilent('clear-compiled');
$this->callSilent('optimize:clear');
$this->callSilent('package:discover');
$this->callSilent('queue:clear');
$this->callSilent('schema:clear');
$this->info('All caches cleared.');
}
}