develop
Last change
on this file since c08466c was 582789f, checked in by beratkjufliju <kufliju@…>, 3 years ago |
added clearAll command
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | <?php
|
---|
2 |
|
---|
3 | namespace App\Console\Commands;
|
---|
4 |
|
---|
5 | use Illuminate\Console\Command;
|
---|
6 | use Illuminate\Support\Facades\Artisan;
|
---|
7 |
|
---|
8 | class ClearAll extends Command
|
---|
9 | {
|
---|
10 | /**
|
---|
11 | * The name and signature of the console command.
|
---|
12 | *
|
---|
13 | * @var string
|
---|
14 | */
|
---|
15 | protected $signature = 'clear:all {--ms : Do migrate fresh and seed}';
|
---|
16 |
|
---|
17 | /**
|
---|
18 | * The console command description.
|
---|
19 | *
|
---|
20 | * @var string
|
---|
21 | */
|
---|
22 | protected $description = 'Clear config, cache, view, route';
|
---|
23 |
|
---|
24 | /**
|
---|
25 | * Create a new command instance.
|
---|
26 | *
|
---|
27 | * @return void
|
---|
28 | */
|
---|
29 | public function __construct()
|
---|
30 | {
|
---|
31 | parent::__construct();
|
---|
32 | }
|
---|
33 |
|
---|
34 | /**
|
---|
35 | * Execute the console command.
|
---|
36 | *
|
---|
37 | * @return mixed
|
---|
38 | */
|
---|
39 | public function handle()
|
---|
40 | {
|
---|
41 | $ms = $this->option("ms");
|
---|
42 |
|
---|
43 | if($ms) {
|
---|
44 | Artisan::call("migrate:fresh");
|
---|
45 | Artisan::call("db:seed");
|
---|
46 | }
|
---|
47 |
|
---|
48 | Artisan::call("config:cache");
|
---|
49 | Artisan::call("cache:clear");
|
---|
50 | Artisan::call("view:clear");
|
---|
51 | Artisan::call("route:clear");
|
---|
52 |
|
---|
53 | if($ms) {
|
---|
54 | $this->info("All data and caches are cleared");
|
---|
55 | } else {
|
---|
56 | $this->info("All caches are cleared");
|
---|
57 | }
|
---|
58 | }
|
---|
59 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.