public function actionCreate($tb)
 {
     $model = new DefineTableField();
     $model->table = $tb;
     if ($model->load($_POST) && $model->save()) {
         $fieldName = $model->name_en;
         $dataType = $model->getFieldType();
         $isNull = $model->is_null;
         $sql = SqlData::getAddFieldSql($tb, $fieldName, $dataType, $isNull);
         LuLu::execute($sql);
         CacheUtility::createFieldCache();
         return $this->redirect(['index', 'tb' => $tb]);
     } else {
         $locals = [];
         $locals['table'] = $tb;
         $locals['model'] = $model;
         return $this->render('create', $locals);
     }
 }
 private function addFields($tableModel)
 {
     $sortNum = 1;
     foreach (SqlData::$initFields as $field) {
         $model = new DefineTableField();
         $model->loadDefaultValues();
         $model->table = $tableModel->id;
         $model->name = $field['name'];
         $model->name_en = $field['name_en'];
         $model->type = $field['type'];
         $model->length = $field['length'];
         $model->is_null = $field['is_null'];
         $model->is_main = $field['is_main'];
         $model->is_sys = $field['is_sys'];
         $model->sort_num = $sortNum;
         $model->note = $field['name'];
         $model->front_form_type = '';
         $model->back_form_type = '';
         $model->save(false);
         $sortNum += 1;
     }
 }