src/controllers/RecordController.php
public function actionUpdate($id = null, $hdomain_id = null)
    {
        if ($id && $hdomain_id && $model = $this->newModel()->findOne(compact('id', 'hdomain_id'))) {
            $model->scenario = 'update';

            return $this->renderAjax('update', ['model' => $model]);
        }

        $collection = (new Collection([
            'model' => $this->newModel(['scenario' => 'update']),
        ]))->load();

        if ($collection->first->id && $collection->save()) {
            Yii::$app->session->addFlash('success', Yii::t('hipanel:dns', '{0, plural, one{DNS record} other{# DNS records}} updated successfully', $collection->count()));

            return $this->renderZoneView($collection->first->hdomain_id);
        }
        throw new BadRequestHttpException('Bad request');
    }
public function actionUpdate($id = null, $hdomain_id = null)
    {
        if ($id && $hdomain_id && $model = $this->newModel()->findOne(compact('id', 'hdomain_id'))) {
            $model->scenario = 'update';

            return $this->renderAjax('update', ['model' => $model]);
        }

        $collection = (new Collection([
            'model' => $this->newModel(['scenario' => 'update']),
        ]))->load();

        if ($collection->first->id && $collection->save()) {
            Yii::$app->session->addFlash('success', Yii::t('hipanel:dns', '{0, plural, one{DNS record} other{# DNS records}} updated successfully', $collection->count()));

            return $this->renderZoneView($collection->first->hdomain_id);
        }
        throw new BadRequestHttpException('Bad request');
    }
public function actionUpdate ( $ id = null , $ hdomain_id = null ) { if ( $ id && $ hdomain_id && $ model = $ this -> newModel ( ) -> findOne ( compact ( 'id' , 'hdomain_id' ) ) ) { $ model -> scenario = 'update' ; return $ this -> renderAjax ( 'update' , [ 'model' => $ model ] ) ; } $ collection = ( new Collection ( [ 'model' => $ this -> newModel ( [ 'scenario' => 'update' ] ) , ] ) ) -> load ( ) ; if ( $ collection -> first -> id && $ collection -> save ( ) ) { Yii :: $ app -> session -> addFlash ( 'success' , Yii :: t ( 'hipanel:dns' , '{0, plural, one{DNS record} other{# DNS records}} updated successfully' , $ collection -> count ( ) ) ) ; return $ this -> renderZoneView ( $ collection -> first -> hdomain_id ) ; } throw new BadRequestHttpException ( 'Bad request' ) ; }
Updates the DNS record.

@param integer $id
@param integer $hdomain_id
@throws BadRequestHttpException
@throws NotFoundHttpException
@return string
Updates the DNS record .