public function actionCreateoffer($id) { $model = $this->findModel($id); if ($model->load(Yii::$app->request->post()) && $model->save()) { $newmodel = AboutHost::find()->where(['host_id' => $model->host_id])->one(); if (count($newmodel) != 1) { return $this->redirect(['abouthost/create', 'host_id' => $model->host_id]); } else { return $this->redirect(['abouthost/update', 'id' => $newmodel->id]); } } else { return $this->render('createoffer', ['model' => $model]); } }
/** * Lists all AboutHost models. * @return mixed */ public function actionIndex() { $dataProvider = new ActiveDataProvider(['query' => AboutHost::find()]); return $this->render('index', ['dataProvider' => $dataProvider]); }