/**
  * Creates a new Setting.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Setting(['active' => 1]);
     //var_dump(Yii::$app->request->post()); //exit;
     $data = Yii::$app->request->post('Setting');
     //var_dump($data); exit;
     //if ($model->load(Yii::$app->request->post()) && $model->save()) {
     if ($data) {
         foreach ($data['key'] as $i => $v) {
             $s = new Setting(['active' => 1]);
             $s->setAttributes(['section' => $data['section'], 'key' => $v, 'value' => $data['value'][$i], 'type' => 'string'], false);
             $r = $s->save();
         }
         //exit;
         return $this->redirect(['index']);
         // 'view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }