mailwolt/app/Livewire/Ui/System/Modal/WebhookDeleteModal.php

32 lines
716 B
PHP

<?php
namespace App\Livewire\Ui\System\Modal;
use App\Models\Webhook;
use LivewireUI\Modal\ModalComponent;
class WebhookDeleteModal extends ModalComponent
{
public int $webhookId;
public string $webhookName = '';
public function mount(int $webhookId): void
{
$webhook = Webhook::findOrFail($webhookId);
$this->webhookId = $webhookId;
$this->webhookName = $webhook->name;
}
public function delete(): void
{
Webhook::findOrFail($this->webhookId)->delete();
$this->dispatch('webhook-saved');
$this->closeModal();
}
public function render()
{
return view('livewire.ui.system.modal.webhook-delete-modal');
}
}