/** * 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]); } }
/** * Lists all AttrVal models. * @return mixed */ public function actionIndex() { $searchModel = new AttrValSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); }