mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-17 05:43:45 +02:00
Fix up database creation and handling code for servers; ref #2447
This commit is contained in:
@@ -362,7 +362,7 @@ class ServersController extends Controller
|
||||
public function newDatabase(StoreServerDatabaseRequest $request, Server $server)
|
||||
{
|
||||
$this->databaseManagementService->create($server, [
|
||||
'database' => $request->input('database'),
|
||||
'database' => DatabaseManagementService::generateUniqueDatabaseName($request->input('database'), $server->id),
|
||||
'remote' => $request->input('remote'),
|
||||
'database_host_id' => $request->input('database_host_id'),
|
||||
'max_connections' => $request->input('max_connections'),
|
||||
|
||||
@@ -110,7 +110,9 @@ class DatabaseController extends ApplicationApiController
|
||||
*/
|
||||
public function store(StoreServerDatabaseRequest $request, Server $server): JsonResponse
|
||||
{
|
||||
$database = $this->databaseManagementService->create($server, $request->validated());
|
||||
$database = $this->databaseManagementService->create($server, array_merge($request->validated(), [
|
||||
'database' => $request->databaseName(),
|
||||
]));
|
||||
|
||||
return $this->fractal->item($database)
|
||||
->transformWith($this->getTransformer(ServerDatabaseTransformer::class))
|
||||
|
||||
Reference in New Issue
Block a user