invoiceRepository = $invoiceRepository; } public function updatedSearch() { $this->resetPage(); } public function updatedStatus() { $this->resetPage(); } public function updatedType() { $this->resetPage(); } public function render() { $query = Invoice::where('customer_id', customer()->id) ->with([ 'invoiceItem.hosting', 'invoiceItem.vps', 'invoiceItem.os.osGroup', 'invoiceItem.addons.addonItems' ]); // Filter by type if specified if (!empty($this->type)) { $query->whereHas('invoiceItem', function($q) { $q->where('product_type', $this->type); }); } // Filter by server_name search if specified if (!empty($this->search)) { $query->whereHas('invoiceItem', function($q) { $q->where('server_name', 'like', '%' . $this->search . '%'); }); } return view('livewire.my-service', [ 'services' => $query->orderBy('created_at', 'desc')->paginate(10) ]); } }