AdmineticWebsiteInstallCommand   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Importance

Changes 4
Bugs 0 Features 1
Metric Value
eloc 26
c 4
b 0
f 1
dl 0
loc 61
rs 10
wmc 5

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A handle() 0 30 4
1
<?php
2
3
namespace Adminetic\Website\Console\Commands;
4
5
use Illuminate\Console\Command;
6
use Illuminate\Support\Facades\Artisan;
7
8
class AdmineticWebsiteInstallCommand extends Command
9
{
10
    /**
11
     * The name and signature of the console command.
12
     *
13
     * @var string
14
     */
15
    protected $signature = 'install:adminetic-website';
16
17
    /**
18
     * The console command description.
19
     *
20
     * @var string
21
     */
22
    protected $description = 'Command to install adminetic website module.';
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 int
38
     */
39
    public function handle()
40
    {
41
        if ($this->confirm('Do you wish to seed module permission?')) {
42
            Artisan::call('adminetic:website-permission');
43
        }
44
        $this->info('Adminetic website permission seeded ... ✅');
45
        if ($this->confirm('Do you wish to publish migration file?')) {
46
            Artisan::call('vendor:publish', ['--tag' => 'website-migrations']);
47
        }
48
        Artisan::call('vendor:publish', ['--tag' => 'website-assets']);
49
        $this->info('Adminetic website assets published ... ✅');
50
        Artisan::call('vendor:publish', ['--tag' => 'website-modules']);
51
        $this->info('Adminetic website module published ... ✅');
52
        Artisan::call('vendor:publish', [
53
            '--tag' => ['website-config'],
54
        ]);
55
        $this->info('Adminetic website config file published ... ✅');
56
        Artisan::call('vendor:publish', [
57
            '--provider' => 'Rappasoft\LaravelLivewireTables\LaravelLivewireTablesServiceProvider',
58
            '--tag' => 'livewire-tables-config',
59
        ]);
60
        $this->info('Laravel datatable config file published ... ✅');
61
62
        if ($this->confirm('Do you wish to run website table migration?')) {
63
            Artisan::call('migrate');
64
            Artisan::call('migrate:adminetic-website');
65
        }
66
        $this->info('Adminetic website module migration complete ... ✅');
67
        $this->info('Adminetic Website Installed.');
68
        $this->info('Star to the admenictic repo would be appreciated.');
69
    }
70
}
71