/** * Creates a new Prefix model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Prefix(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->prefix_id]); } else { return $this->render('create', ['model' => $model]); } }
public function actionCreateVirtual() { $model = new Prefix(); $modelPrefixCapability = new PrefixCapability(); if ($model->load(Yii::$app->request->post()) && $model->save()) { GlobalFunctionController::activity_user("[CREATE PREFIX] Prefix : {$model->prefix} ,Description : {$model->description}, Virtual : {$model->virtual_id}, Type : {$model->type}"); Yii::$app->Controllers->historyUserWithData($model); if ($model->codec_type != "") { $modelPrefixCapability->prefix_id = $model->id; $modelPrefixCapability->codec_type = $model->codec_type; $modelPrefixCapability->save(); } echo 1; //return $this->redirect(['view', 'id' => $model->id]); } else { return $this->renderAjax('create_virtual', ['model' => $model]); } }