/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new AccTemplateItem(); if ($model->load(Yii::$app->request->post())) { if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } } return $this->render('create', array('model' => $model)); }
public function actionSaveSub($id) { $model = $this->loadModel($id); $submodel = new AccTemplateItem(); if ($submodel->load(Yii::$app->request->post())) { if ($submodel->save()) { $this->redirect(array('update', 'id' => $model->id)); } } $this->redirect(array('view', 'id' => $model->id)); }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new AccTemplateItem(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['AccTemplateItem'])) { $model->attributes = $_POST['AccTemplateItem']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } } $this->render('create', array('model' => $model)); }
public function actionSaveSub($id) { $model = $this->loadModel($id); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['AccTemplateItem'])) { $submodel = new AccTemplateItem(); $submodel->attributes = $_POST['AccTemplateItem']; if ($submodel->save()) { $this->redirect(array('update', 'id' => $model->id)); } } $this->redirect(array('view', 'id' => $model->id)); }