search = $this->search; } public function mount() { $this->loadUsers(); } // Get filtered users based on the search input public function loadUsers() { $users = collect(json_decode(file_get_contents(storage_path('app/users.json')), true)); if ($this->search) { $this->users = $users->filter(function ($user) { return str_contains(strtolower($user['username']), strtolower($this->search)) || str_contains(strtolower($user['first_name']), strtolower($this->search)) || str_contains(strtolower($user['last_name']), strtolower($this->search)) || str_contains(strtolower($user['email']), strtolower($this->search)); }); } else { $this->users = $users; } } public function render() { return view('livewire.user-management.user-management', [ 'users' => $this->users, // Pass filtered users here ]); } }