/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
$originalName = $this->argument('feature');
$feature = Pluralizer::plural(ucfirst($this->argument('feature')));
$path = $this->option('path');
$namespace = ucfirst($this->option('namespace'));
$controllerPath = $path . '/' . $feature . '/Controllers';
$modelPath = $path . '/' . $feature . '/Models';
$providersPath = $path . '/' . $feature . '/Providers';
$repositoriesPath = $path . '/' . $feature . '/Repositories';
$this->info('Creating the feature: ' . $feature);
$this->info('On the path: ' . $path);
if ($this->confirm('Do you wish to continue? [yes|no]')) {
$this->info('Creating folders');
// Creating directories
$this->createDirectories($path, $feature, $controllerPath, $modelPath, $providersPath, $repositoriesPath);
$this->file->put($path . '/' . $feature . '/routes.php', '');
// Create files
$this->info('Creating controller');
$controller = new ControllerGenerator($this->file);
$this->printResult($controller->make($controllerPath . '/' . $feature . 'Controller.php', $namespace), $controllerPath . '/' . $feature . 'Controller.php');
$this->info('Creating interface');
$interface = new InterfaceGenerator($this->file);
$this->printResult($interface->make($repositoriesPath . '/' . ucfirst($originalName) . 'Interface.php', $namespace), $repositoriesPath . '/' . ucfirst($originalName) . 'Interface.php');
$this->info('Creating repository');
$repository = new RepositoryGenerator($this->file);
$this->printResult($repository->make($repositoriesPath . '/' . ucfirst($originalName) . 'Repository.php', $namespace), $repositoriesPath . '/' . ucfirst($originalName) . 'Repository.php');
$this->info('Creating model');
$model = new ModelGenerator($this->file);
$this->printResult($model->make($modelPath . '/' . ucfirst($originalName) . '.php', $namespace), $modelPath . '/' . ucfirst($originalName) . '.php');
$this->info('Creating service provider');
$provider = new ProviderGenerator($this->file);
$this->printResult($provider->make($providersPath . '/' . $feature . 'ServiceProvider.php', $namespace), $providersPath . '/' . $feature . 'ServiceProvider.php');
}
}