30 lines
574 B
PHP
30 lines
574 B
PHP
<?php
|
|
|
|
namespace App\Livewire\Admin\Client;
|
|
|
|
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('client-deleted');
|
|
$this->dispatch('notify', message: 'Cliente excluído com sucesso!');
|
|
}
|
|
|
|
public function render()
|
|
{
|
|
return '<div></div>';
|
|
}
|
|
}
|