|
1
|
|
|
<?php namespace Bantenprov\DashboardEpormas\Console\Commands; |
|
2
|
|
|
|
|
3
|
|
|
use Illuminate\Console\Command; |
|
|
|
|
|
|
4
|
|
|
use Illuminate\Support\Facades\Config; |
|
5
|
|
|
use Symfony\Component\Console\Input\InputOption; |
|
|
|
|
|
|
6
|
|
|
use Symfony\Component\Console\Input\InputArgument; |
|
|
|
|
|
|
7
|
|
|
use File; |
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* The EpormasCommand class. |
|
11
|
|
|
* |
|
12
|
|
|
* @package Bantenprov\DashboardEpormas |
|
13
|
|
|
* @author Esza Herdi <[email protected]> |
|
14
|
|
|
*/ |
|
15
|
|
|
class EpormasCommand extends Command |
|
16
|
|
|
{ |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* The name and signature of the console command. |
|
20
|
|
|
* |
|
21
|
|
|
* @var string |
|
22
|
|
|
*/ |
|
23
|
|
|
protected $signature = 'dashboard:epormas'; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* The console command description. |
|
27
|
|
|
* |
|
28
|
|
|
* @var string |
|
29
|
|
|
*/ |
|
30
|
|
|
protected $description = 'Create Controllers, Models, seeds, and Routes command for DashboardEpormas package'; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* The console command variable. |
|
34
|
|
|
* |
|
35
|
|
|
* @var string |
|
36
|
|
|
*/ |
|
37
|
|
|
protected $stubsController = [ |
|
38
|
|
|
'controllers' => [ |
|
39
|
|
|
'DashboardEpormasController.stub', |
|
40
|
|
|
'EpormasCategoryController.stub', |
|
41
|
|
|
'EpormasCityController.stub', |
|
42
|
|
|
'EpormasCounterController.stub' |
|
43
|
|
|
] |
|
44
|
|
|
]; |
|
45
|
|
|
|
|
46
|
|
|
protected $stubsModel = [ |
|
47
|
|
|
'models' => [ |
|
48
|
|
|
'EpormasCategory.stub', |
|
49
|
|
|
'EpormasCity.stub', |
|
50
|
|
|
'EpormasCounter.stub' |
|
51
|
|
|
] |
|
52
|
|
|
]; |
|
53
|
|
|
|
|
54
|
|
|
protected $stubsSeeds = [ |
|
55
|
|
|
'seeds' => [ |
|
56
|
|
|
'EpormasCategoryTableSeeder.stub', |
|
57
|
|
|
'EpormasCityTableSeeder.stub', |
|
58
|
|
|
'EpormasCounterTableSeeder.stub' |
|
59
|
|
|
] |
|
60
|
|
|
]; |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* Create a new command instance. |
|
64
|
|
|
* |
|
65
|
|
|
* @return void |
|
66
|
|
|
*/ |
|
67
|
|
|
public function __construct() |
|
68
|
|
|
{ |
|
69
|
|
|
parent::__construct(); |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
protected function controllerViewCreate() |
|
73
|
|
|
{ |
|
74
|
|
|
foreach($this->stubsController['controllers'] as $stub) |
|
75
|
|
|
{ |
|
76
|
|
|
File::put(base_path('app/Http/Controllers/').str_replace('stub','php',$stub),File::get(__DIR__.'/../../stubs/Controllers/'.$stub)); |
|
|
|
|
|
|
77
|
|
|
} |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
protected function modelViewCreate() |
|
81
|
|
|
{ |
|
82
|
|
|
foreach($this->stubsModel['models'] as $stub) |
|
83
|
|
|
{ |
|
84
|
|
|
File::put(base_path('app/').str_replace('stub','php',$stub),File::get(__DIR__.'/../../stubs/Models/'.$stub)); |
|
|
|
|
|
|
85
|
|
|
} |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
protected function routeViewCreate() |
|
89
|
|
|
{ |
|
90
|
|
|
File::append(base_path('routes/web.php'),File::get(__DIR__.'/../../stubs/routesweb.stub')); |
|
|
|
|
|
|
91
|
|
|
File::append(base_path('routes/api.php'),File::get(__DIR__.'/../../stubs/routesapi.stub')); |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
protected function seedsViewCreate() |
|
95
|
|
|
{ |
|
96
|
|
|
foreach($this->stubsSeeds['seeds'] as $stub) |
|
97
|
|
|
{ |
|
98
|
|
|
File::put(base_path('database/seeds/').str_replace('stub','php',$stub),File::get(__DIR__.'/../../stubs/seeds/'.$stub)); |
|
|
|
|
|
|
99
|
|
|
} |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
|
|
/** |
|
103
|
|
|
* Execute the console command. |
|
104
|
|
|
* |
|
105
|
|
|
* @return mixed |
|
106
|
|
|
*/ |
|
107
|
|
|
public function handle() |
|
108
|
|
|
{ |
|
109
|
|
|
$this->controllerViewCreate(); |
|
110
|
|
|
$this->modelViewCreate(); |
|
111
|
|
|
$this->routeViewCreate(); |
|
112
|
|
|
$this->seedsViewCreate(); |
|
113
|
|
|
$this->info('Create Controllers, Models, seeds, and Routes for DashboardEpormas package success'); |
|
114
|
|
|
} |
|
115
|
|
|
} |
|
116
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths