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