1 <?php
2
3 namespace Scaffolder\Commands;
4
5 use Illuminate\Console\Command;
6 use Illuminate\Support\Facades\File;
7 use Illuminate\Support\Facades\Log;
8
9 class ClearCacheCommand extends Command
10 {
11 12 13 14
15 protected $signature = 'scaffolder:cache-clear';
16
17 18 19 20
21 protected $description = 'Delete compiled files';
22
23 24 25
26 public function handle()
27 {
28 try
29 {
30
31 $compiledFiles = File::glob(base_path('scaffolder-config/cache/*.scf'));
32
33
34 $this->output->progressStart(count($compiledFiles));
35
36 foreach ($compiledFiles as $compiledFile)
37 {
38 File::delete($compiledFile);
39
40
41 $this->output->progressAdvance();
42 }
43
44
45 $this->output->progressFinish();
46
47 $this->info('Cache cleared');
48 }
49 catch (\Exception $exception)
50 {
51 Log::error($exception->getMessage());
52 }
53 }
54 }
55