/**
  * Do this execute.
  *
  * @return  mixed
  */
 protected function doExecute()
 {
     $constant = $this->config['replace.controller.list.name.upper'];
     $table = $this->config['replace.controller.list.name.lower'];
     $file = $this->config['dir.dest'] . '/Table/Table.php';
     if (!is_file($file)) {
         return;
     }
     $code = file_get_contents($file);
     if (strpos($code, 'const ' . $constant . ' = ') !== false) {
         return;
     }
     $replace = "\tconst {$constant} = '{$table}';\n\n";
     $code = GeneratorHelper::addBeforePlaceholder('db-table', $code, $replace);
     file_put_contents($file, $code);
     $this->io->out('[<info>Action</info>] Add table name: ' . $table . ' to Table class.');
 }
 /**
  * Do this execute.
  *
  * @return  mixed
  */
 protected function doExecute()
 {
     $name = $this->config['replace.controller.item.name.cap'];
     $file = $this->config['dir.dest'] . '/Seed/MainSeeder.php';
     if (!is_file($file)) {
         return;
     }
     $code = file_get_contents($file);
     $added = false;
     if (strpos($code, '$this->execute(' . $name . 'Seeder::class);') === false) {
         $replace = "\t\t\$this->execute({$name}Seeder::class);\n\n";
         $code = GeneratorHelper::addBeforePlaceholder('seeder-execute', $code, $replace);
         $added = true;
     }
     if (strpos($code, '$this->clear(' . $name . 'Seeder::class);') === false) {
         $replace = "\t\t\$this->clear({$name}Seeder::class);\n\n";
         $code = GeneratorHelper::addBeforePlaceholder('seeder-clear', $code, $replace);
         $added = true;
     }
     if ($added) {
         file_put_contents($file, $code);
         $this->io->out('[<info>Action</info>] Add seeder to MainSeeder');
     }
 }
    /**
     * Do this execute.
     *
     * @return  mixed
     */
    protected function doExecute()
    {
        $name = $this->config['replace.controller.list.name.lower'];
        $package = $this->config['replace.package.name.lower'];
        $file = $this->config['dir.dest'] . '/Templates/_global/' . $this->config['replace.package.name.lower'] . '/widget/submenu.blade.php';
        if (!is_file($file)) {
            return;
        }
        $code = file_get_contents($file);
        if (strpos($code, "\$helper->menu->active('{$name}')") !== false) {
            return;
        }
        $replace = <<<MENU
\t<a href="{{ \$router->route('{$name}') }}"
        class="list-group-item {{ \$helper->menu->active('{$name}') }}">
        @translate('{$package}.{$name}.title')
    </a>


MENU;
        $code = GeneratorHelper::addBeforePlaceholder('submenu', $code, $replace, '{{--');
        file_put_contents($file, $code);
        $this->io->out('[<info>Action</info>] Add menu item: ' . $name . ' submenu.');
    }