/**
  * Creates a new ToursMeta model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new ToursMeta();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
Ejemplo n.º 2
0
 public function afterSave($insert, $changedAttributes)
 {
     parent::afterSave($insert, $changedAttributes);
     if ($this->is_insert) {
         foreach (self::$required_fields as $f) {
             $tour_meta = new ToursMeta();
             $tour_meta->tour_id = $this->id;
             $tour_meta->tour_key = $f;
             $tour_meta->tour_value = 'int';
             $tour_meta->description = str_replace('_', ' ', $f);
             $tour_meta->save();
         }
     }
 }