InstallCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 1
cbo 1
dl 0
loc 55
ccs 0
cts 27
cp 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A handle() 0 12 1
A publish() 0 8 1
A routes() 0 10 1
1
<?php
2
3
namespace Sco\Admin\Console;
4
5
use Illuminate\Console\Command;
6
7
class InstallCommand extends Command
8
{
9
    /**
10
     * The name and signature of the console command.
11
     *
12
     * @var string
13
     */
14
    protected $signature = 'admin:install
15
                    {--force : Overwrite existing files}';
16
17
    /**
18
     * The console command description.
19
     *
20
     * @var string
21
     */
22
    protected $description = 'Install Sco-Admin Package.';
23
24
    /**
25
     * Execute the console command.
26
     *
27
     * @return mixed
28
     */
29
    public function handle()
30
    {
31
        $this->line('');
32
        $this->line('************************');
33
        $this->line('  Welcome to Sco-Admin  ');
34
        $this->line('************************');
35
36
        $this->publish();
37
        $this->routes();
38
39
        $this->info('Successfully Installed Sco-Admin!');
40
    }
41
42
    protected function publish()
43
    {
44
        $this->line('Publish Resources');
45
        $this->call('vendor:publish', [
46
            '--provider' => 'Sco\Admin\Providers\ResourcesServiceProvider',
47
            '--force'    => true,
48
        ]);
49
    }
50
51
    protected function routes()
52
    {
53
        file_put_contents(
54
            base_path('routes/web.php'),
55
            "\nAdmin::routes();",
56
            FILE_APPEND
57
        );
58
59
        $this->info('Routes generated successfully.');
60
    }
61
}
62