pelican-panel-mirror/app/Services/Servers/ToggleInstallService.php
Lance Pioch 6125b07afa
Remove old admin area (#648)
* Remove old admin

* Remove controller test

* Remove unused exceptions

* Remove unused files

* More small tweaks

* Fix doc block

* Remove unused service

* Restore these

* Add back autoDeploy

* Revert "Add back autoDeploy"

This reverts commit 630c1e08acf8056ce8e612f376fcd00c23d90aea.

* Add these back

* Add back exception

* Remove ApiController again

---------

Co-authored-by: RMartinOscar <40749467+RMartinOscar@users.noreply.github.com>
Co-authored-by: Boy132 <mail@boy132.de>
Co-authored-by: notCharles <charles@pelican.dev>
2024-11-13 17:05:48 -05:00

20 lines
439 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('admin/server.exceptions.marked_as_failed'));
}
$server->status = $server->isInstalled() ? ServerState::Installing : null;
$server->save();
}
}