From fbe5c09c646bb61ea07e46e8029c0f70566bcb4b Mon Sep 17 00:00:00 2001 From: Boy132 Date: Thu, 9 Jan 2025 22:54:32 +0100 Subject: [PATCH] use reinstall service --- app/Filament/Server/Pages/Settings.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/app/Filament/Server/Pages/Settings.php b/app/Filament/Server/Pages/Settings.php index 1e99e939e6..c99932759a 100644 --- a/app/Filament/Server/Pages/Settings.php +++ b/app/Filament/Server/Pages/Settings.php @@ -2,11 +2,10 @@ namespace App\Filament\Server\Pages; -use App\Enums\ServerState; use App\Facades\Activity; use App\Models\Permission; use App\Models\Server; -use App\Repositories\Daemon\DaemonServerRepository; +use App\Services\Servers\ReinstallServerService; use Exception; use Filament\Facades\Filament; use Filament\Forms\Components\Actions\Action; @@ -200,13 +199,11 @@ public function form(Form $form): Form ->modalHeading('Are you sure you want to reinstall the server?') ->modalDescription('Some files may be deleted or modified during this process, please back up your data before continuing.') ->modalSubmitActionLabel('Yes, Reinstall') - ->action(function (Server $server, DaemonServerRepository $serverRepository) { + ->action(function (Server $server, ReinstallServerService $reinstallService) { abort_unless(auth()->user()->can(Permission::ACTION_SETTINGS_REINSTALL, $server), 403); - $server->fill(['status' => ServerState::Installing])->save(); - try { - $serverRepository->setServer($server)->reinstall(); + $reinstallService->handle($server); } catch (Exception $exception) { report($exception);