Fix Server upgrade || fix server overview total credits
This commit is contained in:
commit
b330e5a617
3 changed files with 5 additions and 10 deletions
app/Http/Controllers
themes/default/views/servers
|
@ -38,7 +38,7 @@ class OverViewController extends Controller
|
|||
$counters = collect();
|
||||
//Set basic variables in the collection
|
||||
$counters->put('users', User::query()->count());
|
||||
$counters->put('credits', number_format(User::query()->where('role', '!=', 'admin')->sum('credits'), 2, '.', ''));
|
||||
$counters->put('credits', number_format(User::query()->whereHas("roles", function($q){ $q->where("id", "!=", "1"); })->sum('credits'), 2, '.', ''));
|
||||
$counters->put('payments', Payment::query()->count());
|
||||
$counters->put('eggs', Egg::query()->count());
|
||||
$counters->put('nests', Nest::query()->count());
|
||||
|
|
|
@ -389,6 +389,10 @@ class ServerController extends Controller
|
|||
$server->allocation = $serverAttributes['allocation'];
|
||||
$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."));
|
||||
//restart the server
|
||||
$response = $this->pterodactyl->powerAction($server, 'restart');
|
||||
if ($response->failed()) return redirect()->route('servers.index')->with('error', 'Upgrade Failed! Could not restart the server: ' . $response->json()['errors'][0]['detail']);
|
||||
|
||||
|
||||
// Remove the allocation property from the server object as it is not a column in the database
|
||||
unset($server->allocation);
|
||||
|
@ -406,9 +410,6 @@ class ServerController extends Controller
|
|||
// Withdraw the credits for the new product
|
||||
$user->decrement('credits', $newProduct->price);
|
||||
|
||||
//restart the server
|
||||
$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']);
|
||||
return redirect()->route('servers.show', ['server' => $server->id])->with('success', __('Server Successfully Upgraded'));
|
||||
} else {
|
||||
return redirect()->route('servers.show', ['server' => $server->id])->with('error', __('Not Enough Balance for Upgrade'));
|
||||
|
|
|
@ -201,12 +201,6 @@
|
|||
{{ __('Databases') }}</span>
|
||||
<span class="d-inline-block" x-text="product.databases"></span>
|
||||
</li>
|
||||
<li class="d-flex justify-content-between">
|
||||
<span class="d-inline-block"><i class="fas fa-skull-crossbones"></i>
|
||||
{{ __('OOM Killer') }}</span>
|
||||
<span class="d-inline-block"
|
||||
x-text="product.oom_killer == 1 ? 'enabled' : 'disabled'"></span>
|
||||
</li>
|
||||
<li class="d-flex justify-content-between">
|
||||
<span class="d-inline-block"><i class="fas fa-network-wired"></i>
|
||||
{{ __('Allocations') }}
|
||||
|
|
Loading…
Add table
Reference in a new issue