本文整理汇总了PHP中Illuminate\Console\GeneratorCommand类的典型用法代码示例。如果您正苦于以下问题:PHP GeneratorCommand类的具体用法?PHP GeneratorCommand怎么用?PHP GeneratorCommand使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GeneratorCommand类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: replaceClass
protected function replaceClass($stub, $name)
{
$stub = parent::replaceClass($stub, $name);
$noControllerName = str_replace('Controller', '', $this->getNameInput());
$dummyRoute = config('administr.prefix') . '.' . str_plural(strtolower(snake_case($noControllerName, '-')));
$stub = str_replace('dummyroute', $dummyRoute, $stub);
$appNamespace = $this->getLaravel()->getNamespace();
$dummyModel = str_singular($noControllerName);
$dummyModelNamespaced = $appNamespace . 'Models\\' . $dummyModel;
$stub = str_replace('DummyModelNamespaced', $dummyModelNamespaced, $stub);
$stub = str_replace('DummyModel', $dummyModel, $stub);
$dummyForm = str_singular($noControllerName) . 'Form';
$dummyFormNamespaced = $appNamespace . 'Http\\Forms\\' . $dummyForm;
$stub = str_replace('DummyFormNamespaced', $dummyFormNamespaced, $stub);
$stub = str_replace('DummyForm', $dummyForm, $stub);
$dummyListView = str_plural($noControllerName) . 'ListView';
$dummyListViewNamespaced = $appNamespace . 'Http\\ListViews\\' . $dummyListView;
$stub = str_replace('DummyListViewNamespaced', $dummyListViewNamespaced, $stub);
$stub = str_replace('DummyListView', $dummyListView, $stub);
$viewPath = config('administr.viewPath');
if (strlen($viewPath) > 0) {
$viewPath .= '.';
}
$dummyView = $viewPath . str_plural(snake_case(class_basename($noControllerName), '-'));
$stub = str_replace('dummyview', $dummyView, $stub);
return $stub;
}
示例2: fire
/**
* Execute the console command.
*
* @return void
*/
public function fire()
{
parent::fire();
if (!$this->option('plain')) {
$this->createView();
}
}
示例3: buildClass
/**
* Build the class with the given name.
*
* @param string $name
* @return string
*/
protected function buildClass($name)
{
$stub = parent::buildClass($name);
$modelName = $this->getModelClass($name);
$this->replaceModelNamespace($stub, $modelName)->replaceModelClass($stub, $modelName)->replaceBaseRepositoryNamespace($stub, $this->base)->replaceBaseRepositoryClass($stub, $this->base);
return $stub;
}
示例4: fire
/**
* Execute the command.
*
* @return void
*/
public function fire()
{
parent::fire();
if ($this->option('handler')) {
$this->call('handler:command', ['name' => $this->argument('name') . 'Handler', '--command' => $this->parseName($this->argument('name'))]);
}
}
示例5: buildClass
/**
* Build the class with the given name.
*
* @param string $name
* @return string
*/
protected function buildClass($name)
{
$stub = parent::buildClass($name);
$stub = str_replace('DummyCommand', class_basename($this->option('command')), $stub);
$stub = str_replace('DummyFullCommand', $this->option('command'), $stub);
return $stub;
}
示例6: __construct
/**
* Create a new config clear command instance.
*
* @param Filesystem $files
*/
public function __construct(Filesystem $files)
{
parent::__construct($files);
$this->useEloquent = config('json-api.generator.use-eloquent', true);
$this->subNamespace = config('json-api.generator.namespace', 'JsonApi');
$this->namespaceByResource = config('json-api.generator.by-resource', true);
$this->stubsDirectory = __DIR__ . '/../../../stubs';
}
示例7: fire
/**
* Execute the console command.
*
* @return void
*/
public function fire()
{
if (parent::fire() !== false && $this->option('translated')) {
$name = $this->getNameInput();
$this->type = 'Admin model translation class';
$this->call('administr:model', ['name' => "{$name}Translation"]);
}
}
示例8: buildClass
/**
* Build the class with the given name.
*
* @param string $name
* @return string
*/
protected function buildClass($name)
{
$class = parent::buildClass($name);
if ($this->option('markdown')) {
$class = str_replace('DummyView', $this->option('markdown'), $class);
}
return $class;
}
示例9: buildClass
/**
* @param string $name
*
* @return string
*/
protected function buildClass($name)
{
$stub = parent::buildClass($name);
$table = Str::plural(Str::snake(class_basename($this->argument('name'))));
$this->table = str_replace('._', '_', $table);
$stub = str_replace('DummyTable', $this->table, $stub);
return $stub;
}
示例10: buildClass
/**
* Build the class with the given name.
*
* Remove the base controller import if we are already in base namespace.
*
* @param string $name
* @return string
*/
protected function buildClass($name)
{
$this->info('<info>Created Controller:</info> ' . $name);
$namespace = $this->getNamespace($name);
$class = str_replace("use {$namespace}\\Controller;\n", '', parent::buildClass($name));
$class = str_replace('{{modelName}}', $this->option('model'), $class);
return str_replace('{{view}}', $this->option('view'), $class);
}
示例11: buildClass
protected function buildClass($name)
{
$stub = parent::buildClass($name);
$repository = config('repository.base_repository', Repository::class);
$this->replaceRepository($stub, $repository);
$this->replaceModel($stub);
return $stub;
}
示例12: replaceClass
protected function replaceClass($stub, $name)
{
$stub = parent::replaceClass($stub, $name);
$noListViewName = str_replace('ListView', '', $this->getNameInput());
$dummyRoute = config('administr.prefix') . '.' . str_plural(strtolower(snake_case($noListViewName, '-')));
$stub = str_replace('dummyroute', $dummyRoute, $stub);
return $stub;
}
示例13: fire
/**
* Execute the console command.
*
* @return void
*/
public function fire()
{
parent::fire();
if (!$this->option('no-migration')) {
$table = str_plural(snake_case(class_basename($this->argument('name'))));
$this->call('make:migration', ['name' => "create_{$table}_table", '--create' => $table]);
}
}
示例14: buildClass
/**
* Build the class with the given name.
*
* @param string $name
* @return string
*/
protected function buildClass($name)
{
$fqModelClass = $this->parseModelName($this->argument('name'));
$stub = parent::buildClass($name);
$stub = str_replace('{FQModelClass}', $fqModelClass, $stub);
$stub = str_replace('{Listener}', class_basename($name), $stub);
return $stub;
}
示例15: fire
/**
* Execute the console command.
*
* @return void
*/
public function fire()
{
if (parent::fire() !== false) {
if ($this->option('migration')) {
$table = Str::plural(Str::snake(class_basename($this->argument('name'))));
$this->call('make:migration', ['name' => "create_{$table}_table", '--create' => $table]);
}
}
}