mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-03 15:02:34 +00:00
init
This commit is contained in:
40
app/Http/Livewire/ServerProviders/ConnectProvider.php
Normal file
40
app/Http/Livewire/ServerProviders/ConnectProvider.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire\ServerProviders;
|
||||
|
||||
use App\Actions\ServerProvider\CreateServerProvider;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Livewire\Component;
|
||||
|
||||
class ConnectProvider extends Component
|
||||
{
|
||||
public string $provider = '';
|
||||
|
||||
public string $name;
|
||||
|
||||
public string $token;
|
||||
|
||||
public string $key;
|
||||
|
||||
public string $secret;
|
||||
|
||||
public function connect(): void
|
||||
{
|
||||
app(CreateServerProvider::class)->create(auth()->user(), $this->all());
|
||||
|
||||
$this->emitTo(ProvidersList::class, '$refresh');
|
||||
|
||||
$this->dispatchBrowserEvent('connected', true);
|
||||
}
|
||||
|
||||
public function render(): View
|
||||
{
|
||||
if (request()->query('provider')) {
|
||||
$this->provider = request()->query('provider');
|
||||
}
|
||||
|
||||
return view('livewire.server-providers.connect-provider', [
|
||||
'open' => ! is_null(request()->query('provider')),
|
||||
]);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user