生成代码新增回滚功能

This commit is contained in:
JaguarJack
2020-07-11 10:59:57 +08:00
parent 42e75f50ff
commit 359381fec6
6 changed files with 68 additions and 22 deletions

View File

@@ -12,13 +12,15 @@ class Model extends Factory
{
$content = $this->getContent($params);
file_put_contents($this->getGeneratePath($params['model']), $content);
$modelPath = $this->getGeneratePath($params['model']);
if (!file_exists($this->getGeneratePath($params['model']))) {
file_put_contents($modelPath, $content);
if (!file_exists($modelPath)) {
throw new FailedException('create model failed');
}
return true;
return $modelPath;
}
/**