/** * Creates a new HostsGeneralHelp model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new HostsGeneralHelp(); if ($model->load(Yii::$app->request->post()) && $model->save()) { $newmodel1 = HostsProfessionalHelp::find()->where(['host_id' => $model->host_id])->one(); $newmodel1->delete(); $newmodel2 = HostsArtisticHelp::find()->where(['host_id' => $model->host_id])->one(); $newmodel2->delete(); $modelcount = HostsSkillDetails::find()->where(['host_id' => $model->host_id])->one(); if (count($modelcount) != 1) { return $this->redirect(['hostskilldetails/create', 'host_id' => $model->host_id]); } else { return $this->redirect(['hostskilldetails/update', 'id' => $modelcount->id]); } } else { return $this->render('create', ['model' => $model, 'host_id' => $_GET['host_id']]); } }
/** * Lists all HostsArtisticHelp models. * @return mixed */ public function actionIndex() { $dataProvider = new ActiveDataProvider(['query' => HostsArtisticHelp::find()]); return $this->render('index', ['dataProvider' => $dataProvider]); }
?> <?php echo Html::a('Only Professional Help', ['hostsprofessionalhelp/create', 'host_id' => $host_id], ['class' => 'btn btn-success']); ?> <?php } else { ?> <?php echo Html::a('Only Professional Help', ['hostsprofessionalhelp/update', 'id' => $newmodel1->id], ['class' => 'btn btn-success']); ?> <?php } ?> <?php $newmodel2 = HostsArtisticHelp::find()->where(['host_id' => $host_id])->one(); if (count($newmodel2) != 1) { ?> <?php echo Html::a('Artistic Help', ['hostsartistichelp/create', 'host_id' => $host_id], ['class' => 'btn btn-success']); ?> <?php } else { ?> <?php echo Html::a('Artistic Help', ['hostsartistichelp/update', 'id' => $newmodel1->id], ['class' => 'btn btn-success']); ?> <?php } ?> <?php