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) { /** * * get soap create domain service */ $service =(new KerioManager()) ->getApiByServer($params['serverid']) ->soap ->service() ->createDomain(); /** * product manager allow to check product settings */ $productManager = new ProductManager(); $productManager->loadByHostingId($params['serviceid']); /** * * set params * run service (Create domain in Kerio API) */ $result = $service ->setProductManager($productManager) ->setFormData($params) ->run(); /** * check service result & return error */ if(!$result) { return $service->getError(); } /** * return success response */ return Response::SUCCESS; } }