Completed
Push — master ( 21ddf1...1004bc )
by Sergi Tur
02:59
created

MakeVC::__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 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Acacha\AdminLTETemplateLaravel\Console;
4
5
use Illuminate\Console\Command;
6
7
/**
8
 * Class MakeVC.
9
 */
10
class MakeVC extends Command
11
{
12
13
    /**
14
     * The name and signature of the console command.
15
     */
16
    protected $signature = 'make:vc {link : The route link} {action? : View or controller to create} 
17
    {--t|type=controller : Type of route to create (regular,controller,resource)} {--m|method=get : HTTP method} 
18
    {--api : Route is an api route}';
19
20
    /**
21
     * The console command description.
22
     *
23
     * @var string
24
     */
25
    protected $description = 'Create a view with his corresponding controller and route (vc: view controller) and menu entry';
26
27
    /**
28
     * MakeMVC constructor.
29
     */
30
    public function __construct()
31
    {
32
        parent::__construct();
33
    }
34
35
    /**
36
     * Execute the console command.
37
     */
38
    public function handle()
39
    {
40
        $this->info('Running command ' . $command = $this->command());
41
        passthru($command);
42
    }
43
44
    /**
45
     * Obtain command.
46
     *
47
     * @return string
48
     */
49
    protected function command() {
50
        $api = $this->option('api') ? ' --api '  : '';
51
        $action = $this->argument('action') ? ' ' . $this->argument('action') . ' ' : '';
52
        return 'php artisan make:route ' . $this->argument('link') . $action . ' --type=' . $this->option('type') .
53
            ' --method=' . $this->option('method') .
54
            $api .
55
            ' -a --menu';
56
    }
57
}
58