![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/rentpix.corals.io/app/Console/Commands/ |
<?php namespace App\Console\Commands; use Illuminate\Console\Command; use Illuminate\Support\Facades\Artisan; class ClearCacheCommand extends Command { /** * The name and signature of the console command. * * @var string */ protected $signature = 'c:c {--clear}'; /** * The console command description. * * @var string */ protected $description = 'All Cash Clear'; /** * Create a new command instance. * * @return void */ public function __construct() { parent::__construct(); } /** * Execute the console command. * * @return int */ public function handle() { $clearCommands = [ 'cache:clear', 'config:clear', 'route:clear', 'view:clear', 'debugbar:clear', 'queue:restart', ]; $cacheCommands = [ 'route:cache', 'config:cache' ]; $this->info('Start clear commands'); $this->executeCommands($clearCommands); $this->info('Cache cleared.'); if (!$this->option('clear')) { $this->info('Start cache commands'); $this->executeCommands($cacheCommands); $this->info('Cache executed.'); } } protected function executeCommands($commands) { $bar = $this->output->createProgressBar(count($commands)); $bar->start(); foreach ($commands as $command) { $args = []; if (is_array($command)) { $args = $command['args']; $command = $command['command']; } $this->line("\n$command"); Artisan::call($command, $args); $this->line(Artisan::output()); $bar->advance(); } $this->line("\n"); } }