修复未定义table

This commit is contained in:
yanwenwu 2020-05-19 11:03:42 +08:00
parent 64ce1243b4
commit 48f572168f
2 changed files with 4 additions and 2 deletions

View File

@ -93,6 +93,8 @@ abstract class Factory
{ {
$tables = Db::getConnection()->getTables(); $tables = Db::getConnection()->getTables();
return in_array(\config('database.connections.mysql.prefix') . $table, $tables); $table = \config('database.connections.mysql.prefix') . $table;
return in_array($table, $tables) ? $table : false;
} }
} }

View File

@ -36,7 +36,7 @@ class SQL extends Factory
throw new FailedException('table name has lost~'); throw new FailedException('table name has lost~');
} }
if ($this->hasTableExists($params['table'])) { if ($table = $this->hasTableExists($params['table'])) {
throw new FailedException(sprintf('table [%s] has existed', $params['table'])); throw new FailedException(sprintf('table [%s] has existed', $params['table']));
} }