/**
  * Updates an existing Hosts model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         $hostAvailablity = \app\models\HostsAvailability::find()->where(['host_id' => $model->id])->one();
         if (count($hostAvailablity) != 1) {
             return $this->redirect(['hostsavailability/create', 'host_id' => $model->id]);
         } else {
             return $this->redirect(['hostsavailability/update', 'id' => $hostAvailablity->id]);
         }
     } else {
         if (isset($_GET)) {
             return $this->render('create', ['model' => $model, 'type' => $_GET['type'], 'about' => $_GET['about']]);
         } else {
             return $this->render('create', ['model' => $model]);
         }
     }
 }
 /**
  * Lists all HostsAvailability models.
  * @return mixed
  */
 public function actionIndex()
 {
     $dataProvider = new ActiveDataProvider(['query' => HostsAvailability::find()]);
     return $this->render('index', ['dataProvider' => $dataProvider]);
 }