/**
  * Creates a new MembersAttributesToOptions model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new MembersAttributesToOptions();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         if (Yii::$app->request->isAjax) {
             $response = ['status' => 'success', 'message' => 'Data was successfully saved'];
             \Yii::$app->response->format = 'json';
             return $response;
         } else {
             return $this->redirect(['view', 'id' => $model->id]);
         }
     } else {
         if (Yii::$app->request->isAjax) {
             $response = ['status' => 'failed', 'message' => 'Failed to save data'];
             \Yii::$app->response->format = 'json';
             return $response;
         } else {
             $languages = Lang::find()->all();
             $languageDefault = Lang::findOne(['default' => 1]);
             return $this->render('create', ['model' => $model, 'languages' => $languages, 'languageDefault' => $languageDefault]);
         }
     }
 }