mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-04 15:32:35 +00:00
init
This commit is contained in:
35
app/Http/Livewire/Ssl/CreateSsl.php
Normal file
35
app/Http/Livewire/Ssl/CreateSsl.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire\Ssl;
|
||||
|
||||
use App\Models\Site;
|
||||
use App\Traits\RefreshComponentOnBroadcast;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Livewire\Component;
|
||||
|
||||
class CreateSsl extends Component
|
||||
{
|
||||
use RefreshComponentOnBroadcast;
|
||||
|
||||
public Site $site;
|
||||
|
||||
public string $type = '';
|
||||
|
||||
public string $certificate;
|
||||
|
||||
public string $private;
|
||||
|
||||
public function create(): void
|
||||
{
|
||||
app(\App\Actions\SSL\CreateSSL::class)->create($this->site, $this->all());
|
||||
|
||||
$this->emitTo(SslsList::class, '$refresh');
|
||||
|
||||
$this->dispatchBrowserEvent('created', true);
|
||||
}
|
||||
|
||||
public function render(): View
|
||||
{
|
||||
return view('livewire.ssl.create-ssl');
|
||||
}
|
||||
}
|
46
app/Http/Livewire/Ssl/SslsList.php
Normal file
46
app/Http/Livewire/Ssl/SslsList.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire\Ssl;
|
||||
|
||||
use App\Models\Site;
|
||||
use App\Traits\HasToast;
|
||||
use App\Traits\RefreshComponentOnBroadcast;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Livewire\Component;
|
||||
|
||||
class SslsList extends Component
|
||||
{
|
||||
use RefreshComponentOnBroadcast;
|
||||
use HasToast;
|
||||
|
||||
public Site $site;
|
||||
|
||||
public int $deleteId;
|
||||
|
||||
public function delete(): void
|
||||
{
|
||||
$ssl = $this->site->ssls()->where('id', $this->deleteId)->firstOrFail();
|
||||
|
||||
$ssl->remove();
|
||||
|
||||
$this->refreshComponent([]);
|
||||
|
||||
$this->dispatchBrowserEvent('confirmed', true);
|
||||
}
|
||||
|
||||
public function refreshComponent(array $data): void
|
||||
{
|
||||
if (isset($data['type']) && $data['type'] == 'deploy-ssl-failed') {
|
||||
$this->toast()->error(__('SSL creation failed!'));
|
||||
}
|
||||
|
||||
$this->emit('refreshComponent');
|
||||
}
|
||||
|
||||
public function render(): View
|
||||
{
|
||||
return view('livewire.ssl.ssls-list', [
|
||||
'ssls' => $this->site->ssls,
|
||||
]);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user