fixed:修改命令行无法生成model field
This commit is contained in:
parent
614448d07a
commit
d4ec2d104f
@ -152,7 +152,7 @@ class Utils
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除前缀
|
* 删除表前缀
|
||||||
*
|
*
|
||||||
* @time 2020年12月01日
|
* @time 2020年12月01日
|
||||||
* @param string $table
|
* @param string $table
|
||||||
@ -163,6 +163,19 @@ class Utils
|
|||||||
return str_replace(self::tablePrefix(), '', $table);
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否是超级管理员
|
* 是否是超级管理员
|
||||||
*
|
*
|
||||||
|
@ -50,7 +50,7 @@ class Model extends Factory
|
|||||||
{
|
{
|
||||||
$extra = $params['extra'];
|
$extra = $params['extra'];
|
||||||
|
|
||||||
$table = $params['table'];
|
$table = Utils::tableWithPrefix($params['table']);
|
||||||
|
|
||||||
[$modelName, $namespace] = $this->parseFilename($params['model']);
|
[$modelName, $namespace] = $this->parseFilename($params['model']);
|
||||||
|
|
||||||
@ -92,7 +92,6 @@ class Model extends Factory
|
|||||||
(new Arr)->build(Db::getFields($table))
|
(new Arr)->build(Db::getFields($table))
|
||||||
)->docComment('// 数据库字段映射'));
|
)->docComment('// 数据库字段映射'));
|
||||||
});
|
});
|
||||||
|
|
||||||
})->getContent();
|
})->getContent();
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user