/**
  * Creates a new HostsArtisticHelp model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new HostsArtisticHelp();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         $newmodel = HostsGeneralHelp::find()->where(['host_id' => $model->host_id])->one();
         $newmodel->delete();
         $newmodel1 = HostsProfessionalHelp::find()->where(['host_id' => $model->host_id])->one();
         $newmodel1->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']]);
     }
 }
Esempio n. 2
0
if (count($newmodel) != 1) {
    ?>
        <?php 
    echo Html::a('General OR Professional Help', ['hostsgeneralhelp/create', 'host_id' => $host_id], ['class' => 'btn btn-success']);
    ?>
    <?php 
} else {
    ?>
        <?php 
    echo Html::a('General OR Professional Help', ['hostsgeneralhelp/update', 'id' => $newmodel->id], ['class' => 'btn btn-success']);
    ?>
    <?php 
}
?>
    <?php 
$newmodel1 = HostsProfessionalHelp::find()->where(['host_id' => $host_id])->one();
if (count($newmodel1) != 1) {
    ?>
        <?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 
}
?>
 /**
  * Lists all HostsProfessionalHelp models.
  * @return mixed
  */
 public function actionIndex()
 {
     $dataProvider = new ActiveDataProvider(['query' => HostsProfessionalHelp::find()]);
     return $this->render('index', ['dataProvider' => $dataProvider]);
 }