public function actionAjaxCreate($field, $value) { $model = new D2files(); $model->{$field} = $value; try { if ($model->save()) { return TRUE; } else { return var_export($model->getErrors()); } } catch (Exception $e) { throw new CHttpException(500, $e->getMessage()); } }