Passed
Branch master (d88b3b)
by Prateek
03:56
created

Execute::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 12
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 18
rs 9.8666
1
<?php
2
namespace Prateekkarki\Laragen\Commands;
3
4
use Illuminate\Console\Command;
5
use Illuminate\Support\Composer;
6
use Artisan;
7
8
class Execute extends Command
9
{
10
    /**
11
     * The name and signature of the console command.
12
     *
13
     * @var string
14
     */
15
    protected $signature = 'laragen:exec';
16
    /**
17
     * The console command description.
18
     *
19
     * @var string
20
     */
21
    protected $description = 'Generate/Migrate/Seed your project';
22
23
24
    /**
25
     * Create a new command instance.
26
     *
27
     * @param Composer $composer
28
     * @return void
29
     */
30
    public function __construct(Composer $composer)
31
    {
32
        parent::__construct();
33
34
        $this->composer = $composer;
0 ignored issues
show
Bug Best Practice introduced by
The property composer does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
35
    }
36
37
    /**
38
     * Execute the console command.
39
     *
40
     * @return mixed
41
     */
42
    public function handle()
43
    {
44
        $bar = $this->output->createProgressBar(3);
45
        $bar->setOverwrite(true);
46
        $bar->start();
47
48
        Artisan::call('laragen:make');
49
50
        $this->composer->dumpOptimized();
51
52
        $bar->advance();
53
        Artisan::call('laragen:migrate');
54
55
        $bar->advance();
56
        Artisan::call('laragen:seed');
57
        $bar->finish();
58
        $this->line("\n");
59
        $this->line('Code generation, migration, seeding successfull.');
60
    }
61
}
62