Passed
Push — master ( 8227f6...25b390 )
by Iman
05:05
created

InstallationCommand   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 55
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
B handle() 0 34 3
1
<?php
2
3
namespace crocodicstudio\crudbooster\commands;
4
5
use crocodicstudio\crudbooster\CBCoreModule\Installer\CbInstaller;
6
use crocodicstudio\crudbooster\CBCoreModule\Installer\ConsolePrinter;
7
use crocodicstudio\crudbooster\CBCoreModule\Installer\RequirementChecker;
8
use Illuminate\Console\Command;
9
10
class InstallationCommand extends Command
11
{
12
    /**
13
     * The console command name.
14
     *
15
     * @var string
16
     */
17
    protected $name = 'crudbooster:install';
18
19
    /**
20
     * The console command description.
21
     *
22
     * @var string
23
     */
24
    protected $description = 'CRUDBooster Installation Command';
25
26
    /**
27
     * Execute the console command.
28
     *
29
     * @return mixed
30
     */
31
    public function handle()
32
    {
33
        $printer = new ConsolePrinter($this);
34
35
        $printer->printHeader();
36
37
        if (! ((new RequirementChecker($this))->check())) {
38
            $this->info('Sorry unfortunately your system is not meet with our requirements !');
39
            $printer->printFooter(false);
40
            $this->info('--');
41
42
            return;
43
        }
44
45
        $this->info('Installing: ');
46
        /* Removing the default user and password reset, it makes you ambigous when using CRUDBooster */
47
        $installer = new CbInstaller($this);
48
49
        //$installer->removeDefaultMigrations();
50
51
        $installer->createVendorAtPublic();
52
53
        $installer->symlinkForUpload();
54
55
        $installer->symlinkForAsset();
56
57
        if ($this->confirm('Do you have setting the database configuration at .env ?')) {
58
            $installer->installCrudbooster();
59
        } else {
60
            $this->info('Setup Aborted !');
61
            $this->info('Please setting the database configuration for first !');
62
        }
63
64
        $printer->printFooter();
65
    }
66
}
67