/**
  * Creates a new Categories model by an ajax request.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreateajax()
 {
     $model = new Categories();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         if (Yii::$app->request->isAjax) {
             header('Content-type: application/json');
             echo Json::encode(['status' => 'DONE', 'model' => $model]);
             exit;
         } else {
             return $this->redirect(['view', 'id' => $model->id]);
         }
     }
     return $this->renderAjax('create', ['model' => $model]);
 }
 /**
  * [actionCreate description]
  * @param string module
  * @param integer id
  * @return view         [description]
  */
 public function actionCreate($module = NULL, $id = NULL)
 {
     $model = new Categories();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         if (\Yii::$app->request->isAjax) {
             header('Content-type: application/json');
             echo Json::encode(['status' => 'DONE', 'model' => $model]);
             exit;
         } else {
             return $this->redirect(['view', 'id' => $model->id]);
         }
     } else {
         if (!is_null($module) && !is_null($id)) {
             $model->mod_table = $module;
             $model->mod_id = $id;
         }
         return $this->renderAjax('@frenzelgmbh/cmcategories/widgets/views/iviews/_form', ['model' => $model]);
     }
 }