mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 05:14:46 +02:00

* Fix button * Replace array with index * Fix Server ToggleInstallService * FiNodeVersionsCheck * Fix CreateWebhookConfiguration * Fixdatabasehost post_help > port_help * Fix User CreateServer * Fix Profile language_help * Fix Role permission UserResource * Remove debug & Pint
20 lines
433 B
PHP
20 lines
433 B
PHP
<?php
|
|
|
|
namespace App\Services\Servers;
|
|
|
|
use App\Enums\ServerState;
|
|
use App\Models\Server;
|
|
|
|
class ToggleInstallService
|
|
{
|
|
public function handle(Server $server): void
|
|
{
|
|
if ($server->status === ServerState::InstallFailed) {
|
|
abort(500, trans('exceptions.server.marked_as_failed'));
|
|
}
|
|
|
|
$server->status = $server->isInstalled() ? ServerState::Installing : null;
|
|
$server->save();
|
|
}
|
|
}
|