mirror of
https://github.com/ZorgCC/lumen-generators.git
synced 2024-12-26 14:05:29 +03:00
Ensure commands work and tests pass
This commit is contained in:
parent
573d55c9b2
commit
56f0d9c0a9
@ -9,7 +9,7 @@ class ControllerCommand extends BaseCommand {
|
||||
{model : Name of the model (with namespace if not App)}
|
||||
{--no-routes= : without routes}
|
||||
{--force= : override the existing files}
|
||||
{--laravel= : Boolean (default false) Use Laravel style route definitions}
|
||||
{--laravel : Use Laravel style route definitions}
|
||||
';
|
||||
|
||||
protected $description = 'Generates RESTful controller using the RESTActions trait';
|
||||
@ -38,9 +38,12 @@ class ControllerCommand extends BaseCommand {
|
||||
$options = [
|
||||
'resource' => snake_case($name, '-'),
|
||||
'--controller' => $controller,
|
||||
'--laravel' => $this->input->hasOption('laravel') ? $this->option('laravel') : false
|
||||
];
|
||||
|
||||
if ($this->option('laravel')) {
|
||||
$options['--laravel'] = true;
|
||||
}
|
||||
|
||||
$this->call('wn:route', $options);
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ class ResourceCommand extends BaseCommand {
|
||||
{--path=app : where to store the model file.}
|
||||
{--parsed : tells the command that arguments have been already parsed. To use when calling the command from an other command and passing the parsed arguments and options}
|
||||
{--force= : override the existing files}
|
||||
{--laravel= : Boolean (default false) Use Laravel style route definitions}
|
||||
{--laravel : Use Laravel style route definitions}
|
||||
';
|
||||
|
||||
protected $description = 'Generates a model, migration, controller and routes for RESTful resource';
|
||||
@ -69,8 +69,10 @@ class ResourceCommand extends BaseCommand {
|
||||
'model' => $modelName,
|
||||
'--force' => $this->option('force'),
|
||||
'--no-routes' => false,
|
||||
'--laravel' => $this->input->hasOption('laravel') ? $this->option('laravel') : false
|
||||
];
|
||||
if ($this->option('laravel')) {
|
||||
$controllerOptions['--laravel'] = true;
|
||||
}
|
||||
$this->call('wn:controller', $controllerOptions);
|
||||
|
||||
// generating model factory
|
||||
|
@ -10,7 +10,7 @@ class ResourcesCommand extends BaseCommand {
|
||||
{file : Path to the file containing resources declarations}
|
||||
{--path=app : where to store the model files.}
|
||||
{--force= : override the existing files}
|
||||
{--laravel= : Boolean (default false) Use Laravel style route definitions}
|
||||
{--laravel= : Use Laravel style route definitions}
|
||||
|
||||
';
|
||||
|
||||
@ -36,8 +36,10 @@ class ResourcesCommand extends BaseCommand {
|
||||
'--belongs-to-many' => $i['belongsToMany'],
|
||||
'--path' => $this->option('path'),
|
||||
'--force' => $this->option('force'),
|
||||
'--laravel' => $this->input->hasOption('laravel') ? $this->option('laravel') : false
|
||||
];
|
||||
if ($this->option('laravel')) {
|
||||
$options['--laravel'] = true;
|
||||
}
|
||||
|
||||
$this->call('wn:resource', $options);
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ class RouteCommand extends BaseCommand {
|
||||
protected $signature = 'wn:route
|
||||
{resource : Name of the resource.}
|
||||
{--controller= : Name of the RESTful controller.}
|
||||
{--laravel= : Boolean (default false) Use Laravel style route definitions}
|
||||
{--laravel :R Use Laravel style route definitions}
|
||||
';
|
||||
|
||||
protected $description = 'Generates RESTful routes.';
|
||||
@ -16,7 +16,7 @@ class RouteCommand extends BaseCommand {
|
||||
public function handle()
|
||||
{
|
||||
$resource = $this->argument('resource');
|
||||
$laravelRoutes = $this->input->hasOption('laravel') ? $this->option('laravel') : false;
|
||||
$laravelRoutes = $this->option('laravel');
|
||||
$templateFile = 'routes';
|
||||
$routesPath = 'routes/web.php';
|
||||
if ($laravelRoutes) {
|
||||
@ -61,7 +61,6 @@ class RouteCommand extends BaseCommand {
|
||||
'controller' => $this->getController()
|
||||
])
|
||||
->get();
|
||||
|
||||
$this->save($content, $routesPath, "{$resource} routes", true);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user