actionElementId && $this->actionElementId != "diskDataTable") { $this->data['id'] = $this->actionElementId; $this->data['name'] = VmModel::where("id", $this->actionElementId)->value("name"); } } public function update() { } public function delete() { //init proxmox addon params (new AppParams())->initFromWhmcsParams(); //get vm model $vmModel = VmModel::ofHostingId($this->getWhmcsParamByKey('serviceid')) ->ofId($this->formData['id'])->firstOrFail(); $this->api(); $status = (new VmFactory())->fromVmModel($vmModel)->status()['status']; if (!($status=='running'||$status=='stopped')) { return (new HtmlDataJsonResponse()) ->setStatusError() ->setMessageAndTranslate('The Virtual Machine has been deleted successfully'); } //destory vm // (new CloudService())->delete($vmModel); return (new HtmlDataJsonResponse()) ->setStatusSuccess() ->setMessageAndTranslate('The Virtual Machine has been deleted successfully') ->setCallBackFunction('pmActivateCreateVMButton'); } }