fixed:修改命令行无法生成model field

This commit is contained in:
JaguarJack 2020-12-26 20:56:10 +08:00
parent 614448d07a
commit d4ec2d104f
2 changed files with 15 additions and 3 deletions

View File

@ -152,7 +152,7 @@ class Utils
}
/**
* 删除前缀
* 删除前缀
*
* @time 2020年12月01日
* @param string $table
@ -163,6 +163,19 @@ class Utils
return str_replace(self::tablePrefix(), '', $table);
}
/**
* 添加表前缀
*
* @time 2020年12月26日
* @param string $table
* @return string
*/
public static function tableWithPrefix(string $table)
{
return Str::contains($table, self::tablePrefix()) ?
$table : self::tablePrefix() . $table;
}
/**
* 是否是超级管理员
*

View File

@ -50,7 +50,7 @@ class Model extends Factory
{
$extra = $params['extra'];
$table = $params['table'];
$table = Utils::tableWithPrefix($params['table']);
[$modelName, $namespace] = $this->parseFilename($params['model']);
@ -92,7 +92,6 @@ class Model extends Factory
(new Arr)->build(Db::getFields($table))
)->docComment('// 数据库字段映射'));
});
})->getContent();
}
}