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;
 }
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     parent::fire();
     if (!$this->option('plain')) {
         $this->createView();
     }
 }
 /**
  * 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;
 }
 /**
  * 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'))]);
     }
 }
Exemplo n.º 5
0
 /**
  * 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;
 }
 /**
  * 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';
 }
Exemplo n.º 7
0
 /**
  * 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"]);
     }
 }
 /**
  * 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;
 }
 /**
  * @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;
 }
 /**
  * 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);
 }
Exemplo n.º 11
0
 protected function buildClass($name)
 {
     $stub = parent::buildClass($name);
     $repository = config('repository.base_repository', Repository::class);
     $this->replaceRepository($stub, $repository);
     $this->replaceModel($stub);
     return $stub;
 }
Exemplo n.º 12
0
 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;
 }
Exemplo n.º 13
0
 /**
  * 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]);
     }
 }
Exemplo n.º 14
0
 /**
  * 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;
 }
Exemplo n.º 15
0
 /**
  * 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]);
         }
     }
 }
Exemplo n.º 16
0
 /**
  * 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);
 }
 /**
  * {@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;
 }
 /**
  * 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;
 }
 /**
  * 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;
 }
 /**
  * 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);
 }
Exemplo n.º 21
0
 /**
  * @param string $name
  *
  * @return string
  */
 protected function buildClass($name)
 {
     $stub = parent::buildClass($name);
     $event = $this->option('event');
     if (!Str::startsWith($event, $this->laravel->getNamespace()) && !Str::startsWith($event, 'Illuminate')) {
         $event = $this->laravel->getNamespace() . 'Events\\' . $event;
     }
     $stub = str_replace('DummyDatetime', Carbon::now()->toDateTimeString(), $stub);
     $stub = str_replace('DummyEvent', class_basename($event), $stub);
     $stub = str_replace('DummyFullEvent', $event, $stub);
     return $stub;
 }
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     if (parent::fire() !== false) {
         if (!$this->option('no-routes')) {
             $path = Config::get('generator.path_routes', app_path('Http/routes.php'));
             $path = Config::get('generator.path_routes', app_path('Http/routes.php'));
             $content = $this->files->get($path);
             $name = $this->parseName($this->getNameInput());
             $content .= $this->buildRoute($name);
             $this->files->put($path, $content);
         }
     }
 }
Exemplo n.º 23
0
 public function fire()
 {
     if ($this->compound !== null) {
         if (parent::fire() !== false) {
             if ($this->option($this->compound)) {
                 $name = $this->argument('name');
                 $this->call("hive:{$this->compound}", ['name' => $name]);
             }
         }
     } else {
         parent::fire();
     }
 }
Exemplo n.º 24
0
 /**
  * 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]);
         }
         if ($this->option('controller')) {
             $controller = Str::camel(class_basename($this->argument('name')));
             $this->call('make:controller', ['name' => "{$controller}Controller", '--resource' => true]);
         }
     }
 }
Exemplo n.º 25
0
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     if (parent::fire() !== false) {
         if (!$this->option('no-migration')) {
             $table = $this->getTableInput();
             $path = $this->laravel->databasePath() . '/migrations/' . date('Y_m_d_His') . '_create_' . $table . '_table.php';
             $stub = $this->buildMigration($table);
             $this->files->put($path, $stub);
             $file = pathinfo($path, PATHINFO_FILENAME);
             $this->line("<info>Created Migration:</info> {$file}");
             //$this->call('make:migration', ['name' => "create_{$table}_table", '--create' => $table]);
             if ($this->option('run-migration')) {
                 $this->call('migrate');
             }
         }
     }
 }
Exemplo n.º 26
0
 public function fire()
 {
     if (!$this->app['config']->has('bitdev.generate.namespace.project') || empty($this->app['config']->get('bitdev.generate.namespace.project'))) {
         $this->namespace = $this->app->getNamespace();
         $this->warn('Namespace will defined as ' . trim($this->namespace, '\\'));
     } else {
         $this->namespace = $this->app['config']->get('bitdev.generate.namespace.project');
         $this->info('namespace using ' . trim($this->namespace, '\\'));
     }
     if (!$this->app['config']->has('bitdev.generate.basepath.apps') || empty($this->app['config']->get('bitdev.generate.basepath.apps'))) {
         $this->basepath = $this->app['path'];
         $this->warn('Basepath will defined as ' . trim($this->basepath, '/'));
     } else {
         $this->basepath = $this->app['config']->get('bitdev.generate.basepath.apps');
         $this->info('basepath using ' . trim($this->basepath, '/'));
     }
     parent::fire();
 }
Exemplo n.º 27
0
 public function fire()
 {
     parent::fire();
     $name = str_plural(str_replace('-form', '', snake_case($this->argument('name'), '-')));
     $from = __DIR__ . '/stubs/form.blade.stub';
     $viewPath = config('administr.viewPath');
     if (strlen($viewPath) > 0) {
         $viewPath .= '/';
     }
     $targetPath = resource_path("views/{$viewPath}{$name}/");
     $fileName = 'form.blade.php';
     if ($this->files->exists($targetPath . $fileName)) {
         $this->error("File views/{$viewPath}{$name}/{$fileName} already exists!");
         return;
     }
     if (!$this->files->isDirectory($targetPath)) {
         $this->files->makeDirectory($targetPath);
     }
     if ($this->files->copy($from, $targetPath . $fileName)) {
         $this->info("Created views/{$viewPath}{$name}/{$fileName}");
         return;
     }
     $this->error("Could not create views/{$viewPath}{$name}/{$fileName}");
 }
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     $this->module = $this->findModule();
     parent::fire();
 }
Exemplo n.º 29
0
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     parent::fire();
 }
Exemplo n.º 30
0
 protected function getNameInput()
 {
     $name = parent::getNameInput();
     //if ($this->option('which') == 'implementation') {
     //    $name = 'Parse'.$name;
     //}
     return $name;
 }