1
|
|
|
<?php namespace Wn\Generators; |
2
|
|
|
|
3
|
|
|
use Illuminate\Support\ServiceProvider; |
4
|
|
|
|
5
|
|
|
class CommandsServiceProvider extends ServiceProvider |
6
|
|
|
{ |
7
|
|
|
public function boot() |
8
|
|
|
{ |
9
|
|
|
$configPath = __DIR__.'/../config/lumen-generators.php'; |
10
|
|
|
$this->publishes([ |
11
|
|
|
$configPath => base_path('config/lumen-generators.php'), |
12
|
|
|
]); |
13
|
|
|
} |
14
|
|
|
|
15
|
|
|
public function register() |
16
|
|
|
{ |
17
|
|
|
$configPath = __DIR__.'/../config/lumen-generators.php'; |
18
|
|
|
$this->mergeConfigFrom($configPath, 'lumen-generators'); |
19
|
|
|
|
20
|
|
|
$this->registerPublishCommand(); |
21
|
|
|
$this->registerModelCommand(); |
22
|
|
|
$this->registerControllerRestActionsCommand(); |
23
|
|
|
$this->registerControllerCommand(); |
24
|
|
|
$this->registerRouteCommand(); |
25
|
|
|
$this->registerMigrationCommand(); |
26
|
|
|
$this->registerResourceCommand(); |
27
|
|
|
$this->registerResourcesCommand(); |
28
|
|
|
$this->registerPivotTableCommand(); |
29
|
|
|
$this->registerFactoryCommand(); |
30
|
|
|
// registerSeederCommand |
31
|
|
|
// registerPivotSeederCommand |
32
|
|
|
// registerTestCommand |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
protected function registerPublishCommand(){ |
36
|
|
|
$this->app->singleton('command.wn.publish', function($app){ |
37
|
|
|
return $app['Wn\Generators\Commands\PublishCommand']; |
38
|
|
|
}); |
39
|
|
|
$this->commands('command.wn.publish'); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
protected function registerModelCommand(){ |
43
|
|
|
$this->app->singleton('command.wn.model', function($app){ |
44
|
|
|
return $app['Wn\Generators\Commands\ModelCommand']; |
45
|
|
|
}); |
46
|
|
|
$this->commands('command.wn.model'); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
protected function registerControllerRestActionsCommand(){ |
50
|
|
|
$this->app->singleton('command.wn.controller.rest-actions', function($app){ |
51
|
|
|
return $app['Wn\Generators\Commands\ControllerRestActionsCommand']; |
52
|
|
|
}); |
53
|
|
|
$this->commands('command.wn.controller.rest-actions'); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
protected function registerControllerCommand(){ |
57
|
|
|
$this->app->singleton('command.wn.controller', function($app){ |
58
|
|
|
return $app['Wn\Generators\Commands\ControllerCommand']; |
59
|
|
|
}); |
60
|
|
|
$this->commands('command.wn.controller'); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
protected function registerMigrationCommand(){ |
64
|
|
|
$this->app->singleton('command.wn.migration', function($app){ |
65
|
|
|
return $app['Wn\Generators\Commands\MigrationCommand']; |
66
|
|
|
}); |
67
|
|
|
$this->commands('command.wn.migration'); |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
protected function registerRouteCommand(){ |
71
|
|
|
$this->app->singleton('command.wn.route', function($app){ |
72
|
|
|
return $app['Wn\Generators\Commands\RouteCommand']; |
73
|
|
|
}); |
74
|
|
|
$this->commands('command.wn.route'); |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
protected function registerTestCommand(){ |
78
|
|
|
$this->app->singleton('command.wn.test', function($app){ |
79
|
|
|
return $app['Wn\Generators\Commands\TestCommand']; |
80
|
|
|
}); |
81
|
|
|
$this->commands('command.wn.test'); |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
protected function registerResourceCommand(){ |
85
|
|
|
$this->app->singleton('command.wn.resource', function($app){ |
86
|
|
|
return $app['Wn\Generators\Commands\ResourceCommand']; |
87
|
|
|
}); |
88
|
|
|
$this->commands('command.wn.resource'); |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
protected function registerResourcesCommand(){ |
92
|
|
|
$this->app->singleton('command.wn.resources', function($app){ |
93
|
|
|
return $app['Wn\Generators\Commands\ResourcesCommand']; |
94
|
|
|
}); |
95
|
|
|
$this->commands('command.wn.resources'); |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
protected function registerPivotTableCommand(){ |
99
|
|
|
$this->app->singleton('command.wn.pivot-table', function($app){ |
100
|
|
|
return $app['Wn\Generators\Commands\PivotTableCommand']; |
101
|
|
|
}); |
102
|
|
|
$this->commands('command.wn.pivot-table'); |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
protected function registerFactoryCommand(){ |
106
|
|
|
$this->app->singleton('command.wn.factory', function($app){ |
107
|
|
|
return $app['Wn\Generators\Commands\FactoryCommand']; |
108
|
|
|
}); |
109
|
|
|
$this->commands('command.wn.factory'); |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
protected function registerSeederCommand(){ |
113
|
|
|
$this->app->singleton('command.wn.seeder', function($app){ |
114
|
|
|
return $app['Wn\Generators\Commands\SeederCommand']; |
115
|
|
|
}); |
116
|
|
|
$this->commands('command.wn.seeder'); |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
protected function registerPivotSeederCommand(){ |
120
|
|
|
$this->app->singleton('command.wn.pivot.seeder', function($app){ |
121
|
|
|
return $app['Wn\Generators\Commands\PivotSeederCommand']; |
122
|
|
|
}); |
123
|
|
|
$this->commands('command.wn.pivot.seeder'); |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
} |
127
|
|
|
|