删除冗余代码

This commit is contained in:
JaguarJack 2020-05-28 08:24:49 +08:00
parent 107a7d48da
commit 39c0ec4c48

View File

@ -58,56 +58,4 @@ class ModelGeneratorCommand extends Command
$output->error(sprintf('%s Create Failed!', $modelFile));
}
}
private function getTableFields($table): array
{
$fields = Db::query('show full columns from ' .
config('database.connections.mysql.prefix') . $table);
$new = [];
foreach ($fields as $field) {
$new[$field['Field']] = $field['Comment'];
}
return $new;
}
private function generateFields($fields)
{
$f = '';
foreach ($fields as $field => $comment) {
$f .= sprintf("'%s', // %s" . "\r\n\t\t", $field, $comment);
}
return rtrim($f, "\r\n\t\t");
}
private function replaceContent(array $replace)
{
return str_replace([
'{Module}', '{Class}', '{Name}', '{Field}'
], $replace, $this->content());
}
private function content()
{
return <<<EOT
<?php
namespace catchAdmin\{Module}\model;
use catcher\base\CatchModel;
class {Class} extends CatchModel
{
protected \$name = '{Name}';
protected \$field = [
{Field}
];
}
EOT;
}
}