/** * Creates a new AttrVal model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new AttrVal(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('create', ['model' => $model]); } }
/** * Displays a single Attr model. * @param integer $id * @return mixed */ public function actionView($id) { $searchModel = new AttrValSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams, $id); $model = $this->findModel($id); $valmodel = new AttrVal(); if ($valmodel->load(Yii::$app->request->post())) { if ($valmodel->save()) { return $this->redirect(['view', 'id' => $model->id]); } } else { return $this->render('view', ['model' => $model, 'list' => $model->getVals(), 'dataProvider' => $dataProvider, 'valmodel' => $valmodel]); } }