query = ''; $this->searchResults = Collection::empty(); } public function render() { return view('livewire.search-product'); } public function updatedQuery() { $this->searchResults = Product::where('product_name', 'like', '%' . $this->query . '%') ->orWhere('product_code', 'like', '%' . $this->query . '%') ->take(6)->get(); } public function resetQuery() { $this->query = ''; $this->searchResults = Collection::empty(); } public function selectProduct($product) { $this->emit('productSelected', $product); } }