src/PeskyCMF/Console/Commands/CmfMakeScaffoldCommand.php
public function handle() {
        $table = $this->getTableObjectByTableName($this->argument('table_name'));

        $namespace = $this->getScaffoldsNamespace();
        $className = $this->getScaffoldClassName($table, $this->option('resource'));

        $filePath = $this->getFolder($namespace) . $className . '.php';
        if (File::exist($filePath)) {
            if ($this->confirm("Scaffold class file {$filePath} already exists. Overwrite?")) {
                File::remove($filePath);
            } else {
                $this->line('Terminated');
                return;
            }
        }

        $this->createScaffoldClassFile($table, $namespace, $className, $filePath);


        $this->line($filePath . ' created');

        $columnsTranslations = [];
        foreach ($table->getTableStructure()->getColumns() as $column) {
            $columnsTranslations[] = "'{$column->getName()}' => ''";
        }
        $columnsTranslationsFilter = implode(",\n                    ", $columnsTranslations) . ",";
        $columnsTranslations = implode(",\n                ", $columnsTranslations) . ",";

        $this->comment(<<<INFO

Translations:
    '{$table->getTableStructure()->getTableName()}' => [
        'menu_title' => '',
        'datagrid' => [
            'header' => '',
            'column' => [
                $columnsTranslations
            ],
            'filter' => [
                '{$table->getTableStructure()->getTableName()}' => [
                    $columnsTranslationsFilter
                ],
            ],
        ],
        'form' => [
            'header_create' => '',
            'header_edit' => '',
            'input' => [
                $columnsTranslations
            ],
        ],
        'item_details' => [
            'header' => '',
            'field' => [
                $columnsTranslations
            ],
        ]
    ]

INFO
);
    }
public function handle() {
        $table = $this->getTableObjectByTableName($this->argument('table_name'));

        $namespace = $this->getScaffoldsNamespace();
        $className = $this->getScaffoldClassName($table, $this->option('resource'));

        $filePath = $this->getFolder($namespace) . $className . '.php';
        if (File::exist($filePath)) {
            if ($this->confirm("Scaffold class file {$filePath} already exists. Overwrite?")) {
                File::remove($filePath);
            } else {
                $this->line('Terminated');
                return;
            }
        }

        $this->createScaffoldClassFile($table, $namespace, $className, $filePath);


        $this->line($filePath . ' created');

        $columnsTranslations = [];
        foreach ($table->getTableStructure()->getColumns() as $column) {
            $columnsTranslations[] = "'{$column->getName()}' => ''";
        }
        $columnsTranslationsFilter = implode(",\n                    ", $columnsTranslations) . ",";
        $columnsTranslations = implode(",\n                ", $columnsTranslations) . ",";

        $this->comment(<<<INFO

Translations:
    '{$table->getTableStructure()->getTableName()}' => [
        'menu_title' => '',
        'datagrid' => [
            'header' => '',
            'column' => [
                $columnsTranslations
            ],
            'filter' => [
                '{$table->getTableStructure()->getTableName()}' => [
                    $columnsTranslationsFilter
                ],
            ],
        ],
        'form' => [
            'header_create' => '',
            'header_edit' => '',
            'input' => [
                $columnsTranslations
            ],
        ],
        'item_details' => [
            'header' => '',
            'field' => [
                $columnsTranslations
            ],
        ]
    ]

INFO
);
    }
public function handle ( ) { $ table = $ this -> getTableObjectByTableName ( $ this -> argument ( 'table_name' ) ) ; $ namespace = $ this -> getScaffoldsNamespace ( ) ; $ className = $ this -> getScaffoldClassName ( $ table , $ this -> option ( 'resource' ) ) ; $ filePath = $ this -> getFolder ( $ namespace ) . $ className . '.php' ; if ( File :: exist ( $ filePath ) ) { if ( $ this -> confirm ( "Scaffold class file {$filePath} already exists. Overwrite?" ) ) { File :: remove ( $ filePath ) ; } else { $ this -> line ( 'Terminated' ) ; return ; } } $ this -> createScaffoldClassFile ( $ table , $ namespace , $ className , $ filePath ) ; $ this -> line ( $ filePath . ' created' ) ; $ columnsTranslations = [ ] ; foreach ( $ table -> getTableStructure ( ) -> getColumns ( ) as $ column ) { $ columnsTranslations [ ] = "'{$column->getName()}' => ''" ; } $ columnsTranslationsFilter = implode ( ",\n                    " , $ columnsTranslations ) . "," ; $ columnsTranslations = implode ( ",\n                " , $ columnsTranslations ) . "," ; $ this -> comment ( <<<INFO

Translations:
    '{$table->getTableStructure()->getTableName()}' => [
        'menu_title' => '',
        'datagrid' => [
            'header' => '',
            'column' => [
                $columnsTranslations
            ],
            'filter' => [
                '{$table->getTableStructure()->getTableName()}' => [
                    $columnsTranslationsFilter
                ],
            ],
        ],
        'form' => [
            'header_create' => '',
            'header_edit' => '',
            'input' => [
                $columnsTranslations
            ],
        ],
        'item_details' => [
            'header' => '',
            'field' => [
                $columnsTranslations
            ],
        ]
    ]

INFO ) ; }
Execute the console command.
Execute the console command .