customers = $customers; if (isset($this->selectedCustomer)) { $this->contacts = Customer::find($this->selectedCustomer)->contacts; } else { $this->contacts = $customers->first()->contacts; } } public function updateContactList() { $this->contacts = Customer::find($this->selectedCustomer)->contacts; } public function render() { return view('livewire.customer-and-contact-select', [ 'customers' => $this->customers, 'contacts' => $this->contacts, ]); } }