feat: Filtro adicionado.

This commit is contained in:
LukiBeg 2025-12-10 18:04:05 -03:00
parent 38ea1f7385
commit 1c8f03a45d
1 changed files with 20 additions and 3 deletions

View File

@ -8,16 +8,33 @@
class ShowClient extends Component
{
public $filters = '';
public $clients;
public function mount()
{
$this->clients = Client::all();
}
#[On('filters-added')]
public function updatedFilters()
{
$this->clients = Client::where('name', 'LIKE', '%' . $this->filters . '%')->get();
}
#[On('client-deleted')]
#[On('client-updated')]
#[On('client-added')]
public function refreshClients()
{
$this->clients = Client::all();
}
public function render()
{
$clients = Client::all();
return view('livewire.admin.show-client', [
'clients' => $clients
'clients' => $this->clients
]);
}
}