vCenterRepository = $vCenterRepository; $this->datacenterRepository = $datacenterRepository; } public function mount() { $this->vcenters = $this->vCenterRepository->filter(['status' => 1], [], [], ['id', 'host']); } public function updatedVcenterId($value) { if (!empty($value)) { $this->datacenters = $this->datacenterRepository->filter( ['vcenter_id' => $value], [], [], ['id', 'name'] ); } else { $this->datacenters = []; } $this->datacenter_id = null; // reset datacenter nếu vcenter đổi } public function render() { return view('livewire.vcenter-datacenter-select', [ 'vcenters' => $this->vcenters ]); } }