From 1c8f03a45d6e91fb21a62624df7e92d32eb43900 Mon Sep 17 00:00:00 2001 From: LukiBeg Date: Wed, 10 Dec 2025 18:04:05 -0300 Subject: [PATCH] feat: Filtro adicionado. --- app/Livewire/ShowClient.php | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/app/Livewire/ShowClient.php b/app/Livewire/ShowClient.php index 3565f20..ea11573 100644 --- a/app/Livewire/ShowClient.php +++ b/app/Livewire/ShowClient.php @@ -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 ]); } }