mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-02 14:36:17 +00:00
init
This commit is contained in:
33
app/Http/Livewire/ServerSshKeys/AddExistingKey.php
Normal file
33
app/Http/Livewire/ServerSshKeys/AddExistingKey.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?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->emitTo(ServerKeysList::class, '$refresh');
|
||||
|
||||
$this->dispatchBrowserEvent('added', true);
|
||||
}
|
||||
|
||||
public function render(): View
|
||||
{
|
||||
return view('livewire.server-ssh-keys.add-existing-key', [
|
||||
'keys' => SshKey::all(),
|
||||
]);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user