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 ]); } }