fix server upgrade
This commit is contained in:
parent
67cbde2fa1
commit
2c9b933c6d
1 changed files with 1 additions and 8 deletions
|
@ -389,13 +389,6 @@ class ServerController extends Controller
|
||||||
$server->allocation = $serverAttributes['allocation'];
|
$server->allocation = $serverAttributes['allocation'];
|
||||||
$response = $this->pterodactyl->updateServer($server, $newProduct);
|
$response = $this->pterodactyl->updateServer($server, $newProduct);
|
||||||
if ($response->failed()) return redirect()->route('servers.index')->with('error', __("The system was unable to update your server product. Please try again later or contact support."));
|
if ($response->failed()) return redirect()->route('servers.index')->with('error', __("The system was unable to update your server product. Please try again later or contact support."));
|
||||||
//update user balance
|
|
||||||
$user->decrement('credits', $priceupgrade);
|
|
||||||
//restart the server
|
|
||||||
$response = $this->pterodactyl->powerAction($server, 'restart');
|
|
||||||
if ($response->failed()) {
|
|
||||||
return redirect()->route('servers.index')->with('error', $response->json()['errors'][0]['detail']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove the allocation property from the server object as it is not a column in the database
|
// Remove the allocation property from the server object as it is not a column in the database
|
||||||
unset($server->allocation);
|
unset($server->allocation);
|
||||||
|
@ -414,7 +407,7 @@ class ServerController extends Controller
|
||||||
$user->decrement('credits', $newProduct->price);
|
$user->decrement('credits', $newProduct->price);
|
||||||
|
|
||||||
//restart the server
|
//restart the server
|
||||||
$response = Pterodactyl::powerAction($server, "restart");
|
$response = $this->pterodactyl->powerAction($server, 'restart');
|
||||||
if ($response->failed()) return redirect()->route('servers.index')->with('error', 'Server upgraded successfully! Could not restart the server: ' . $response->json()['errors'][0]['detail']);
|
if ($response->failed()) return redirect()->route('servers.index')->with('error', 'Server upgraded successfully! Could not restart the server: ' . $response->json()['errors'][0]['detail']);
|
||||||
return redirect()->route('servers.show', ['server' => $server->id])->with('success', __('Server Successfully Upgraded'));
|
return redirect()->route('servers.show', ['server' => $server->id])->with('success', __('Server Successfully Upgraded'));
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue