checkExtensionOrThrowError(); //update domain if($params['customfields']['maildomain']){ $params['domain'] = $params['customfields']['maildomain']; $this->hosting()->domain = $params['domain']; $this->hosting()->save(); } /** * run kerio service */ $result = $this->kerioRunService($params); return $result; }catch (\Exception $ex) { /** * return some crit error */ return $ex->getMessage(); } } /** * @param null $params * @return mixed|string */ protected function kerioRunService($params = null) { $domains = array($params['domain']); $api = new KerioConnectApi('whmcsKerioEmail', 'Thurdata', '1.0'); try { $api->login($params['serverhostname'], $params['serverusername'], $params['serverpassword']); $result = $api->sendRequest('Domains.create', $domains); logModuleCall( 'kerioEmail', __FUNCTION__, $domains, 'Debug Features & Attributes', $result ); $api->logout(); } catch (KerioApiException $error) { logModuleCall( 'kerioEmail', __FUNCTION__, $error, 'Debug Error', $error->getMessage() ); return ['error' => $error->getMessage()]; } /** * return success response */ return Response::SUCCESS; } }