mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-01 05:56:16 +00:00
31
app/Http/Livewire/Services/InstallPHPMyAdmin.php
Normal file
31
app/Http/Livewire/Services/InstallPHPMyAdmin.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire\Services;
|
||||
|
||||
use App\Actions\Service\InstallPHPMyAdmin as InstallPHPMyAdminAction;
|
||||
use App\Models\Server;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Livewire\Component;
|
||||
|
||||
class InstallPHPMyAdmin extends Component
|
||||
{
|
||||
public Server $server;
|
||||
|
||||
public string $allowed_ip;
|
||||
|
||||
public string $port = '5433';
|
||||
|
||||
public function install(): void
|
||||
{
|
||||
app(InstallPHPMyAdminAction::class)->install($this->server, $this->all());
|
||||
|
||||
$this->dispatchBrowserEvent('started', true);
|
||||
|
||||
$this->emitTo(ServicesList::class, '$refresh');
|
||||
}
|
||||
|
||||
public function render(): View
|
||||
{
|
||||
return view('livewire.services.install-phpmyadmin');
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@
|
||||
namespace App\Http\Livewire\Services;
|
||||
|
||||
use App\Models\Server;
|
||||
use App\Models\Service;
|
||||
use App\Traits\RefreshComponentOnBroadcast;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Livewire\Component;
|
||||
@ -15,6 +16,7 @@ class ServicesList extends Component
|
||||
|
||||
public function stop(int $id): void
|
||||
{
|
||||
/** @var Service $service */
|
||||
$service = $this->server->services()->where('id', $id)->firstOrFail();
|
||||
|
||||
$service->stop();
|
||||
@ -24,6 +26,7 @@ public function stop(int $id): void
|
||||
|
||||
public function start(int $id): void
|
||||
{
|
||||
/** @var Service $service */
|
||||
$service = $this->server->services()->where('id', $id)->firstOrFail();
|
||||
|
||||
$service->start();
|
||||
@ -33,6 +36,7 @@ public function start(int $id): void
|
||||
|
||||
public function restart(int $id): void
|
||||
{
|
||||
/** @var Service $service */
|
||||
$service = $this->server->services()->where('id', $id)->firstOrFail();
|
||||
|
||||
$service->restart();
|
||||
@ -40,6 +44,16 @@ public function restart(int $id): void
|
||||
$this->refreshComponent([]);
|
||||
}
|
||||
|
||||
public function uninstall(int $id): void
|
||||
{
|
||||
/** @var Service $service */
|
||||
$service = $this->server->services()->where('id', $id)->firstOrFail();
|
||||
|
||||
$service->uninstall();
|
||||
|
||||
$this->refreshComponent([]);
|
||||
}
|
||||
|
||||
public function render(): View
|
||||
{
|
||||
return view('livewire.services.services-list', [
|
||||
|
Reference in New Issue
Block a user