vito/app/Actions/Server/RebootServer.php
Saeed Vaziry 428140b931
refactoring (#116)
- refactoring architecture
- fix incomplete ssh logs
- code editor for scripts in the app
- remove Jobs and SSHCommands
2024-03-14 20:03:43 +01:00

24 lines
444 B
PHP

<?php
namespace App\Actions\Server;
use App\Enums\ServerStatus;
use App\Models\Server;
use Throwable;
class RebootServer
{
public function reboot(Server $server): Server
{
try {
$server->os()->reboot();
$server->status = ServerStatus::DISCONNECTED;
$server->save();
} catch (Throwable) {
$server = $server->checkConnection();
}
return $server;
}
}