fiexed bug

This commit is contained in:
JaguarJack 2020-04-30 18:15:48 +08:00
parent fbc4a6201a
commit 4e38e7ede2
2 changed files with 7 additions and 1 deletions

View File

@ -4,6 +4,7 @@ namespace catcher\generate\factory;
use catcher\exceptions\FailedException;
use catcher\generate\template\Model as Template;
use think\facade\Db;
use think\helper\Str;
class Model extends Factory
{
@ -38,6 +39,11 @@ class Model extends Factory
[$modelName, $namespace] = $this->parseFilename($params['model']);
// 如果填写了表名并且没有填写模型名称 使用表名作为模型名称
if (!$modelName && $table) {
$modelName = Str::camel($table);
}
if (!$modelName) {
throw new FailedException('model name not set');
}

View File

@ -5,7 +5,7 @@ namespace catcher\generate\factory;
use catcher\exceptions\FailedException;
use think\facade\Db;
class SQL
class SQL extends Factory
{
protected $index = '';