lasthourcloud/app/Http/Livewire/Server/Proxy/Status.php
2023-09-28 11:33:16 +02:00

33 lines
744 B
PHP

<?php
namespace App\Http\Livewire\Server\Proxy;
use App\Jobs\ContainerStatusJob;
use App\Models\Server;
use Livewire\Component;
class Status extends Component
{
public Server $server;
protected $listeners = ['proxyStatusUpdated'];
public function proxyStatusUpdated()
{
$this->server->refresh();
}
public function getProxyStatus()
{
try {
dispatch_sync(new ContainerStatusJob($this->server));
$this->emit('proxyStatusUpdated');
} catch (\Throwable $e) {
return handleError($e, $this);
}
}
public function getProxyStatusWithNoti()
{
$this->emit('success', 'Refreshed proxy status.');
$this->getProxyStatus();
}
}