Example #1
0
 /**
  * Lists all Post models.
  * @return mixed
  */
 public function actionIndex()
 {
     $model = new Setting();
     $dataProvider = new ActiveDataProvider(['query' => Setting::find()]);
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['index']);
     }
     return $this->render('index', ['dataProvider' => $dataProvider, 'model' => $model]);
 }
Example #2
0
 /**
  * Creates a new Setting model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Setting();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
 /**
  * Creates a new Setting model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Setting();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         Yii::$app->session->setFlash('success', 'Well done! successfully to save data!  ');
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
 /**
  * Creates a new Setting model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $Setting = new Setting();
     $Setting_en = new Setting_en();
     $Setting_ru = new Setting_ru();
     if ($Setting->load(Yii::$app->request->post()) && $Setting_en->load(Yii::$app->request->post()) && $Setting_ru->load(Yii::$app->request->post()) && $Setting->save()) {
         $Setting_en->setting_id = $Setting->id;
         $Setting_ru->setting_id = $Setting->id;
         $Setting_en->save();
         $Setting_ru->save();
         return $this->redirect(['view', 'id' => $Setting->id]);
     } else {
         return $this->render('create', ['Setting' => $Setting, 'Setting_en' => $Setting_en, 'Setting_ru' => $Setting_ru]);
     }
 }