/**
  * 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']]);
     }
 }
 /**
  * Finds the HostsArtisticHelp model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return HostsArtisticHelp the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = HostsArtisticHelp::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
示例#3
0
    ?>
        <?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