@@ 10-58 (lines=49) @@ | ||
7 | /** |
|
8 | * Class MakeV. |
|
9 | */ |
|
10 | class MakeV extends Command |
|
11 | { |
|
12 | ||
13 | /** |
|
14 | * The name and signature of the console command. |
|
15 | */ |
|
16 | protected $signature = 'make:v {link : The route link} {action? : View to create} |
|
17 | {--t|type=regular : 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 route and menu entry'; |
|
26 | ||
27 | /** |
|
28 | * MakeV 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 | { |
|
51 | $api = $this->option('api') ? ' --api ' : ''; |
|
52 | $action = $this->argument('action') ? ' ' . $this->argument('action') . ' ' : ''; |
|
53 | return 'php artisan make:route ' . $this->argument('link') . $action . ' --type=' . $this->option('type') . |
|
54 | ' --method=' . $this->option('method') . |
|
55 | $api . |
|
56 | ' -a --menu'; |
|
57 | } |
|
58 | } |
|
59 |
@@ 10-59 (lines=50) @@ | ||
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 |
|
26 | (vc: view controller) and menu entry'; |
|
27 | ||
28 | /** |
|
29 | * MakeVC constructor. |
|
30 | */ |
|
31 | public function __construct() |
|
32 | { |
|
33 | parent::__construct(); |
|
34 | } |
|
35 | ||
36 | /** |
|
37 | * Execute the console command. |
|
38 | */ |
|
39 | public function handle() |
|
40 | { |
|
41 | $this->info('Running command ' . $command = $this->command()); |
|
42 | passthru($command); |
|
43 | } |
|
44 | ||
45 | /** |
|
46 | * Obtain command. |
|
47 | * |
|
48 | * @return string |
|
49 | */ |
|
50 | protected function command() |
|
51 | { |
|
52 | $api = $this->option('api') ? ' --api ' : ''; |
|
53 | $action = $this->argument('action') ? ' ' . $this->argument('action') . ' ' : ''; |
|
54 | return 'php artisan make:route ' . $this->argument('link') . $action . ' --type=' . $this->option('type') . |
|
55 | ' --method=' . $this->option('method') . |
|
56 | $api . |
|
57 | ' -a --menu'; |
|
58 | } |
|
59 | } |
|
60 |