vito/app/Http/Livewire/ServerSshKeys/AddExistingKey.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

34 lines
678 B
PHP

<?php
namespace App\Http\Livewire\ServerSshKeys;
use App\Models\Server;
use App\Models\SshKey;
use Illuminate\Contracts\View\View;
use Livewire\Component;
class AddExistingKey extends Component
{
public Server $server;
public string $key_id = '';
public function add(): void
{
$key = SshKey::query()->findOrFail($this->all()['key_id']);
$key->deployTo($this->server);
$this->dispatch('$refresh')->to(ServerKeysList::class);
$this->dispatch('added');
}
public function render(): View
{
return view('livewire.server-ssh-keys.add-existing-key', [
'keys' => SshKey::all(),
]);
}
}