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) { $api = new KerioWhmcs('whmcsKerioEmail', 'Thurdata', '1.0'); try { $api->login($params['serverhostname'], $params['serverusername'], $params['serverpassword']); $result = $api->createDomain($params['domain']); $domainID = $result['result'][0]['id']; $api->logout(); logModuleCall( 'kerioEmail', __FUNCTION__, $params, 'Debug ID', $this->productManager->get('acc_base') ); } catch (KerioApiException $error) { logModuleCall( 'kerioEmail', __FUNCTION__, $error, 'Debug Error', $error->getMessage() ); return ['error' => $error->getMessage()]; } /** * return success response */ return Response::SUCCESS; } }