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