作者:administrcm
项目:administ
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;
}
作者:ngangchil
项目:laravel-widget
/**
* Execute the console command.
*
* @return void
*/
public function fire()
{
parent::fire();
if (!$this->option('plain')) {
$this->createView();
}
}
作者:czi
项目:laravel-repositor
/**
* 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;
}
作者:ngitimfoy
项目:Nyari-AppPH
/**
* 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'))]);
}
}
作者:qasem2rubi
项目:larave
/**
* 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;
}
作者:cloudcreativit
项目:laravel-json-ap
/**
* 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';
}
作者:administrcm
项目:localizatio
/**
* 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"]);
}
}
作者:jarnovanleeuwe
项目:framewor
/**
* 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;
}
作者:vampirekis
项目:lumen-restful-starter-ki
/**
* @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;
}
作者:aiddroi
项目:laravel-curd-generato
/**
* 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);
}
作者:znc
项目:repositor
protected function buildClass($name)
{
$stub = parent::buildClass($name);
$repository = config('repository.base_repository', Repository::class);
$this->replaceRepository($stub, $repository);
$this->replaceModel($stub);
return $stub;
}
作者:administrcm
项目:listvie
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;
}
作者:HarveyChen
项目:myblo
/**
* 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]);
}
}
作者:elode
项目:elode
/**
* 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;
}
作者:manhvu121
项目:videoplatfor
/**
* 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]);
}
}
}
作者:stevedadd
项目:reac
/**
* Determine if the class already exists.
*
* @param string $rawName
* @return bool
*/
protected function alreadyExists($rawName)
{
try {
$reflection = new ReflectionClass($rawName);
return true;
} catch (Exception $e) {
return false;
}
return parent::alreadyExists($rawName);
}
作者:jenk
项目:laravel-api-generator
/**
* {@inheritdoc}
*/
protected function replaceNamespace(&$stub, $name)
{
$parent = parent::replaceNamespace($stub, $name);
$stub = str_replace('DummyModelClass', $this->getModelName($name), $stub);
$resourceName = $this->getResourceName();
$stub = str_replace('DummyResourceClass', ucfirst($resourceName), $stub);
$stub = str_replace('DummyResourceNamePlural', Str::plural($resourceName), $stub);
$stub = str_replace('DummyResourceName', $resourceName, $stub);
return $parent;
}
作者:manhvu121
项目:videoplatfor
/**
* Build the class with the given name.
*
* @param string $name
* @return string
*/
protected function buildClass($name)
{
$stub = parent::buildClass($name);
$event = $this->option('event');
if (!Str::startsWith($event, $this->laravel->getNamespace())) {
$event = $this->laravel->getNamespace() . 'Events\\' . $event;
}
$stub = str_replace('DummyEvent', class_basename($event), $stub);
$stub = str_replace('DummyFullEvent', $event, $stub);
return $stub;
}
作者:ayurmedi
项目:faveo-helpdes
/**
* Build the class with the given name.
*
* @param string $name
* @return string
*/
protected function buildClass($name)
{
$stub = parent::buildClass($name);
$event = $this->option('event');
if (!starts_with($event, $this->getAppNamespace())) {
$event = $this->getAppNamespace() . 'Events\\' . $event;
}
$stub = str_replace('{{event}}', class_basename($event), $stub);
$stub = str_replace('{{fullEvent}}', $event, $stub);
return $stub;
}
作者:vampirekis
项目:lumen-restful-starter-ki
/**
* Build the class with the given name.
*
* @param string $name
*
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
* @return string
*/
protected function buildClass($name)
{
$stub = parent::buildClass($name);
list($resourceStub, $actionStub) = explode('#split', $stub);
if ($this->option('model')) {
$modelClass = Str::singular(str_replace('.', '\\', $this->getNameInput()));
$resourceStub = str_replace(['DummyModelClass'], [$modelClass], $resourceStub);
return trim($resourceStub);
}
return trim($actionStub);
}