mailwolt/app/Livewire/Ui/System/WebhookTable.php

28 lines
654 B
PHP

<?php
namespace App\Livewire\Ui\System;
use App\Models\Webhook;
use Livewire\Attributes\Layout;
use Livewire\Attributes\Title;
use Livewire\Component;
#[Layout('layouts.dvx')]
#[Title('Webhooks · Mailwolt')]
class WebhookTable extends Component
{
public function toggleActive(int $id): void
{
$webhook = Webhook::findOrFail($id);
$webhook->update(['is_active' => !$webhook->is_active]);
}
public function render()
{
return view('livewire.ui.system.webhook-table', [
'webhooks' => Webhook::orderByDesc('created_at')->get(),
'allEvents' => Webhook::allEvents(),
]);
}
}