vito/app/Http/Livewire/ServerSshKeys/ServerKeysList.php
Saeed Vaziry 8bffefabef
Upgrade to Livewire 3 (#103)
* upgrade to livewire 3

* fix updater

* fix modal events

* fix modal events
2024-02-04 18:11:22 +01:00

41 lines
795 B
PHP

<?php
namespace App\Http\Livewire\ServerSshKeys;
use App\Models\Server;
use App\Models\SshKey;
use App\Traits\RefreshComponentOnBroadcast;
use Illuminate\Contracts\View\View;
use Livewire\Component;
class ServerKeysList extends Component
{
use RefreshComponentOnBroadcast;
public Server $server;
public int $deleteId;
protected $listeners = [
'$refresh',
];
public function delete(): void
{
$key = SshKey::query()->findOrFail($this->deleteId);
$key->deleteFrom($this->server);
$this->refreshComponent([]);
$this->dispatch('confirmed');
}
public function render(): View
{
return view('livewire.server-ssh-keys.server-keys-list', [
'keys' => $this->server->sshKeys,
]);
}
}