update:更新代码生成

This commit is contained in:
JaguarJack 2020-09-17 21:15:24 +08:00
parent 8b65690450
commit 4216a48907
2 changed files with 9 additions and 7 deletions

View File

@ -52,15 +52,17 @@ class Generator
array_push($message, 'migration created successfully'); array_push($message, 'migration created successfully');
} }
// 只有最后成功才写入 route // 只有创建了 Controller 最后成功才写入 route
if ($params['create_controller']) {
(new Route())->controller($controller['controller']) (new Route())->controller($controller['controller'])
->restful($controller['restful']) ->restful($controller['restful'])
// ->methods((new Controller())->parseOtherMethods($controller['other_function'])) // ->methods((new Controller())->parseOtherMethods($controller['other_function']))
->done(); ->done();
}
} catch (\Exception $exception) { } catch (\Exception $exception) {
$this->rollback($files, $migration, $table); $this->rollback($files, $migration, $table);
throw new FailedException($exception->getMessage()); throw new FailedException($exception->getFile() . $exception->getLine() . $exception->getMessage());
} }

View File

@ -91,7 +91,7 @@ abstract class Factory
*/ */
public function hasTableExists($table) public function hasTableExists($table)
{ {
$tables = Db::getConnection()->getTables(); $tables = Db::connect()->getTables();
return in_array($table, $tables) ? $table : false; return in_array($table, $tables) ? $table : false;
} }