query = ''; $this->users = []; } public function clearSearch() { $this->query = ''; } public function setUser($id) { $user = User::find($id); $this->id = $id; $this->name = $user->name; } public function unsetUser() { unset($this->id); unset($this->name); $this->query = ''; } public function render() { if ($this->query) { $users = User::where('name', 'like', '%' . $this->query . '%')->take(10)->get(); $this->users = $users->toArray(); } return view('user::livewire.search.selector'); } }