正在显示
1 个修改的文件
包含
2 行增加
和
11 行删除
| @@ -8,6 +8,7 @@ | @@ -8,6 +8,7 @@ | ||
| 8 | namespace App\Console\Commands; | 8 | namespace App\Console\Commands; |
| 9 | 9 | ||
| 10 | use App\Models\Project; | 10 | use App\Models\Project; |
| 11 | +use App\Services\ProjectServer; | ||
| 11 | use Illuminate\Console\Command; | 12 | use Illuminate\Console\Command; |
| 12 | use Illuminate\Support\Facades\DB; | 13 | use Illuminate\Support\Facades\DB; |
| 13 | use Illuminate\Support\Facades\Schema; | 14 | use Illuminate\Support\Facades\Schema; |
| @@ -71,11 +72,7 @@ class ProjectInit extends Command | @@ -71,11 +72,7 @@ class ProjectInit extends Command | ||
| 71 | // 创建数据库失败 添加通知以及再次处理 | 72 | // 创建数据库失败 添加通知以及再次处理 |
| 72 | } | 73 | } |
| 73 | // 设置 database.connections.custom_mysql 数据 | 74 | // 设置 database.connections.custom_mysql 数据 |
| 74 | - config(['database.connections.custom_mysql.host' => $project->mysqlConfig()->host]); | ||
| 75 | - config(['database.connections.custom_mysql.port' => $project->mysqlConfig()->port]); | ||
| 76 | - config(['database.connections.custom_mysql.database' => $project->databaseName()]); | ||
| 77 | - config(['database.connections.custom_mysql.username' => $project->mysqlConfig()->user]); | ||
| 78 | - config(['database.connections.custom_mysql.password' => $project->mysqlConfig()->password]); | 75 | + ProjectServer::useProject($project->id); |
| 79 | 76 | ||
| 80 | // TODO 创建对应库 初始化数据表 | 77 | // TODO 创建对应库 初始化数据表 |
| 81 | $this->initTable(); | 78 | $this->initTable(); |
| @@ -87,12 +84,6 @@ class ProjectInit extends Command | @@ -87,12 +84,6 @@ class ProjectInit extends Command | ||
| 87 | */ | 84 | */ |
| 88 | public function initTable() | 85 | public function initTable() |
| 89 | { | 86 | { |
| 90 | -// $table = DB::select('show tables'); | ||
| 91 | -// $table = array_column($table, 'Tables_in_globalso_dev'); | ||
| 92 | -// $table = DB::connection('custom_tmp_mysql')->select('show tables'); | ||
| 93 | -// $table_in = DB::connection('custom_tmp_mysql')->getDatabaseName(); | ||
| 94 | -// dd($table, $table_in); | ||
| 95 | - | ||
| 96 | $database_name = DB::connection('custom_tmp_mysql')->getDatabaseName(); | 87 | $database_name = DB::connection('custom_tmp_mysql')->getDatabaseName(); |
| 97 | 88 | ||
| 98 | $table = Schema::connection('custom_tmp_mysql')->getAllTables(); | 89 | $table = Schema::connection('custom_tmp_mysql')->getAllTables(); |
-
请 注册 或 登录 后发表评论