select('enabletsdns', 'domaintsdns', 'urlapi', 'keyapi')->first(); if ($settings->enabletsdns) { $tsdnsClient = new TSDNS($settings->urlapi, $settings->keyapi); if (!$tsdnsClient) { throw new Exception('The subdomains availability could not be checked. Contact support.'); } $id = Capsule::table('tblcustomfields')->where('fieldname', 'Subdomain')->value('id'); $request = $tsdnsClient->getZone($params['customfield'][$id] . '.' . $settings->domaintsdns); $zone = json_decode($request->body); if (count($zone->message)) { throw new Exception('Subdomain is already in use'); } } } catch (Exception $e) { $errors = array(); $errors[] = $e->getMessage(); return $errors; } } add_hook("ShoppingCartValidateProductUpdate", 1, "hook_check_subdomain");