Completed
Push — master ( 13753b...66beca )
by wen
03:53
created

InstallCommand::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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
16
    /**
17
     * The console command description.
18
     *
19
     * @var string
20
     */
21
    protected $description = 'Install Sco Admin Package(publish/migrate).';
22
23
    /**
24
     * Create a new command instance.
25
     *
26
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
27
     */
28
    public function __construct()
29
    {
30
        parent::__construct();
31
    }
32
33
    /**
34
     * Execute the console command.
35
     *
36
     * @return mixed
37
     */
38
    public function handle()
39
    {
40
        $this->line('');
41
        $this->line('************************');
42
        $this->line('  Welcome to Sco Admin  ');
43
        $this->line('************************');
44
45
        $this->publish();
46
        $this->migrate();
47
        $this->seed();
0 ignored issues
show
Bug introduced by
The method seed() does not seem to exist on object<Sco\Admin\Console\InstallCommand>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
48
    }
49
50
    protected function publish()
51
    {
52
        $this->line('Publish Resources');
53
        $this->line('');
54
        $this->call('vendor:publish', [
55
            '--provider' => 'Sco\Admin\Providers\AdminServiceProvider',
56
            '--force'    => true,
57
        ]);
58
    }
59
60
    protected function migrate()
61
    {
62
        $this->line('Running Database Migrations');
63
        $this->line('');
64
        $this->call('migrate', ['--force' => true]);
65
        $this->line('');
66
67
        $this->line('Seeding database');
68
        $this->line('');
69
        $this->call('db:seed', [
70
            '--force' => true,
71
            '--class' => \AdminTableSeeder::class,
72
        ]);
73
        $this->line('');
74
75
    }
76
}
77