for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Nwidart\Modules\Commands;
use Nwidart\Modules\Support\Stub;
use Nwidart\Modules\Traits\ModuleCommandTrait;
use Symfony\Component\Console\Input\InputArgument;
class RouteProviderMakeCommand extends GeneratorCommand
{
use ModuleCommandTrait;
protected $argumentName = 'module';
/**
* The command name.
*
* @var string
*/
protected $name = 'module:route-provider';
* The command description.
protected $description = 'Create a new route service provider for the specified module.';
* The command arguments.
* @return array
protected function getArguments()
return [
['module', InputArgument::OPTIONAL, 'The name of module will be used.'],
];
}
* Get template contents.
* @return string
protected function getTemplateContents()
return (new Stub('/route-provider.stub', [
'MODULE' => $this->getModuleName(),
'NAME' => $this->getFileName(),
'MODULE_NAMESPACE' => $this->laravel['modules']->config('namespace'),
]))->render();
private function getFileName()
return 'RouteServiceProvider';
* Get the destination file path.
protected function getDestinationFilePath()
$path = $this->laravel['modules']->getModulePath($this->getModuleName());
$generatorPath = $this->laravel['modules']->config('paths.generator.provider');
return $path . $generatorPath . '/' . $this->getFileName() . '.php';