From 93b202bde45902d53f11653c8a33b151f15714c2 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 18 Sep 2023 12:29:50 +0200 Subject: [PATCH] fix: convert startProxy to action --- app/Actions/Proxy/StartProxy.php | 4 +++- app/Http/Livewire/Server/Proxy/Deploy.php | 2 +- app/Jobs/ContainerStatusJob.php | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/Actions/Proxy/StartProxy.php b/app/Actions/Proxy/StartProxy.php index fd14f49d5..7af5aa019 100644 --- a/app/Actions/Proxy/StartProxy.php +++ b/app/Actions/Proxy/StartProxy.php @@ -6,11 +6,13 @@ use App\Enums\ProxyStatus; use App\Enums\ProxyTypes; use App\Models\Server; use Illuminate\Support\Str; +use Lorisleiva\Actions\Concerns\AsAction; use Spatie\Activitylog\Models\Activity; class StartProxy { - public function __invoke(Server $server, bool $async = true): Activity|string + use AsAction; + public function handle(Server $server, bool $async = true): Activity|string { $proxyType = data_get($server,'proxy.type'); if ($proxyType === 'none') { diff --git a/app/Http/Livewire/Server/Proxy/Deploy.php b/app/Http/Livewire/Server/Proxy/Deploy.php index ad60ca53a..506fd3b81 100644 --- a/app/Http/Livewire/Server/Proxy/Deploy.php +++ b/app/Http/Livewire/Server/Proxy/Deploy.php @@ -27,7 +27,7 @@ class Deploy extends Component SaveConfiguration::run($this->server); } - $activity = resolve(StartProxy::class)($this->server); + $activity = StartProxy::run($this->server); $this->emit('newMonitorActivity', $activity->id); } catch (\Throwable $e) { return handleError($e); diff --git a/app/Jobs/ContainerStatusJob.php b/app/Jobs/ContainerStatusJob.php index 20d6640bd..b7c76363c 100644 --- a/app/Jobs/ContainerStatusJob.php +++ b/app/Jobs/ContainerStatusJob.php @@ -82,7 +82,7 @@ class ContainerStatusJob implements ShouldQueue, ShouldBeEncrypted })->first(); if (!$foundProxyContainer) { if ($this->server->isProxyShouldRun()) { - resolve(StartProxy::class)($this->server, false); + StartProxy::run($this->server, false); $this->server->team->notify(new ContainerRestarted('coolify-proxy', $this->server)); } } else {