feat: Deleta clientes.

This commit is contained in:
lukibeg 2025-11-16 21:49:50 -03:00
parent 6abd11dce7
commit 5451f5c9ab
1 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,30 @@
<?php
namespace App\Livewire\Admin;
use Livewire\Component;
use Livewire\Attributes\On;
use App\Models\Client;
class DeleteClient extends Component
{
#[On('confirm-delete')]
public function deleteClient($payload)
{
$deletedClient = Client::findOrFail($payload);
if ($deletedClient) {
$deletedClient->delete();
}
$this->dispatch('clientDeleted');
// (Opcional) Envia uma notificação de sucesso
$this->dispatch('notify', message: 'Cliente excluído com sucesso!');
}
public function render()
{
return '<div></div>';
}
}