Passed
Push — master ( d2ddcd...7d7316 )
by Reza
04:17
created

Uninstall::handle()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 16
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 11
nc 2
nop 0
dl 0
loc 16
rs 9.9
c 0
b 0
f 0
1
<?php
2
3
namespace EasyPanel\Commands\Actions;
4
5
use Illuminate\Console\Command;
6
use Illuminate\Support\Facades\File;
7
8
class Uninstall extends Command
9
{
10
11
    protected $signature = 'panel:uninstall';
12
    protected $description = 'Uninstall the panel';
13
14
    public function handle()
15
    {
16
        $status = $this->confirm("Do you really want to uninstall the panel ? (All files and components will be deleted)", true);
17
        if($status){
18
            File::deleteDirectory(app_path('Http/Livewire/Admin'));
19
            File::deleteDirectory(resource_path('views/livewire/admin'));
20
            File::deleteDirectory(resource_path('views/vendor/admin'));
21
            File::deleteDirectory(resource_path('cruds'));
22
            File::deleteDirectory(public_path('assets/admin'));
23
            File::delete(config_path('easy_panel.php'));
24
            $this->info("All files and components was deleted!");
25
26
            return;
27
        }
28
29
        $this->info("The process was canceled");
30
    }
31
32
}
33