mirror of
https://github.com/ZorgCC/lumen-generators.git
synced 2024-12-27 06:25:28 +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)}
|
{model : Name of the model (with namespace if not App)}
|
||||||
{--no-routes= : without routes}
|
{--no-routes= : without routes}
|
||||||
{--force= : override the existing files}
|
{--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';
|
protected $description = 'Generates RESTful controller using the RESTActions trait';
|
||||||
@ -38,9 +38,12 @@ class ControllerCommand extends BaseCommand {
|
|||||||
$options = [
|
$options = [
|
||||||
'resource' => snake_case($name, '-'),
|
'resource' => snake_case($name, '-'),
|
||||||
'--controller' => $controller,
|
'--controller' => $controller,
|
||||||
'--laravel' => $this->input->hasOption('laravel') ? $this->option('laravel') : false
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if ($this->option('laravel')) {
|
||||||
|
$options['--laravel'] = true;
|
||||||
|
}
|
||||||
|
|
||||||
$this->call('wn:route', $options);
|
$this->call('wn:route', $options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ class ResourceCommand extends BaseCommand {
|
|||||||
{--path=app : where to store the model file.}
|
{--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}
|
{--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}
|
{--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';
|
protected $description = 'Generates a model, migration, controller and routes for RESTful resource';
|
||||||
@ -69,8 +69,10 @@ class ResourceCommand extends BaseCommand {
|
|||||||
'model' => $modelName,
|
'model' => $modelName,
|
||||||
'--force' => $this->option('force'),
|
'--force' => $this->option('force'),
|
||||||
'--no-routes' => false,
|
'--no-routes' => false,
|
||||||
'--laravel' => $this->input->hasOption('laravel') ? $this->option('laravel') : false
|
|
||||||
];
|
];
|
||||||
|
if ($this->option('laravel')) {
|
||||||
|
$controllerOptions['--laravel'] = true;
|
||||||
|
}
|
||||||
$this->call('wn:controller', $controllerOptions);
|
$this->call('wn:controller', $controllerOptions);
|
||||||
|
|
||||||
// generating model factory
|
// generating model factory
|
||||||
|
@ -10,7 +10,7 @@ class ResourcesCommand extends BaseCommand {
|
|||||||
{file : Path to the file containing resources declarations}
|
{file : Path to the file containing resources declarations}
|
||||||
{--path=app : where to store the model files.}
|
{--path=app : where to store the model files.}
|
||||||
{--force= : override the existing 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'],
|
'--belongs-to-many' => $i['belongsToMany'],
|
||||||
'--path' => $this->option('path'),
|
'--path' => $this->option('path'),
|
||||||
'--force' => $this->option('force'),
|
'--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);
|
$this->call('wn:resource', $options);
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ class RouteCommand extends BaseCommand {
|
|||||||
protected $signature = 'wn:route
|
protected $signature = 'wn:route
|
||||||
{resource : Name of the resource.}
|
{resource : Name of the resource.}
|
||||||
{--controller= : Name of the RESTful controller.}
|
{--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.';
|
protected $description = 'Generates RESTful routes.';
|
||||||
@ -16,7 +16,7 @@ class RouteCommand extends BaseCommand {
|
|||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
$resource = $this->argument('resource');
|
$resource = $this->argument('resource');
|
||||||
$laravelRoutes = $this->input->hasOption('laravel') ? $this->option('laravel') : false;
|
$laravelRoutes = $this->option('laravel');
|
||||||
$templateFile = 'routes';
|
$templateFile = 'routes';
|
||||||
$routesPath = 'routes/web.php';
|
$routesPath = 'routes/web.php';
|
||||||
if ($laravelRoutes) {
|
if ($laravelRoutes) {
|
||||||
@ -61,7 +61,6 @@ class RouteCommand extends BaseCommand {
|
|||||||
'controller' => $this->getController()
|
'controller' => $this->getController()
|
||||||
])
|
])
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
$this->save($content, $routesPath, "{$resource} routes", true);
|
$this->save($content, $routesPath, "{$resource} routes", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user