getResult(); return array_column($columns, 'Field'); } public function generate($params) { list($db, $table, $path, $tplFile, $tplDir) = $params; $this->generateData($db, $table, $path, $tplFile, $tplDir); } public function generateData($db, $table, $path, $tplFile, $tplDir) { $config = [ 'tplFilename' => $tplFile, 'tplDir' => $tplDir, 'className' => $table, ]; $file = alias($path); $file .= sprintf('/%s%s.php', ucfirst($table), $tplFile); $columnSchemas = $this->getColumns($table); $data = [ 'dbName' => $db, 'className' => ucfirst($table), 'tableName' => $table, 'namespace' => "App\\Models\\$tplFile", 'columns' => $columnSchemas ]; $gen = new FileGenerator($config); $gen->getParser()->setOpenCloseTagChars("{{", "}}"); $gen->renderas($file, $data); } }