作者 zhl

'u'

... ... @@ -8,6 +8,7 @@
namespace App\Console\Commands;
use App\Models\Project;
use App\Services\ProjectServer;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
... ... @@ -71,11 +72,7 @@ class ProjectInit extends Command
// 创建数据库失败 添加通知以及再次处理
}
// 设置 database.connections.custom_mysql 数据
config(['database.connections.custom_mysql.host' => $project->mysqlConfig()->host]);
config(['database.connections.custom_mysql.port' => $project->mysqlConfig()->port]);
config(['database.connections.custom_mysql.database' => $project->databaseName()]);
config(['database.connections.custom_mysql.username' => $project->mysqlConfig()->user]);
config(['database.connections.custom_mysql.password' => $project->mysqlConfig()->password]);
ProjectServer::useProject($project->id);
// TODO 创建对应库 初始化数据表
$this->initTable();
... ... @@ -87,12 +84,6 @@ class ProjectInit extends Command
*/
public function initTable()
{
// $table = DB::select('show tables');
// $table = array_column($table, 'Tables_in_globalso_dev');
// $table = DB::connection('custom_tmp_mysql')->select('show tables');
// $table_in = DB::connection('custom_tmp_mysql')->getDatabaseName();
// dd($table, $table_in);
$database_name = DB::connection('custom_tmp_mysql')->getDatabaseName();
$table = Schema::connection('custom_tmp_mysql')->getAllTables();
... ...