Ejemplo n.º 1
0
 /**
  * using in the ajax submiting case, when click on a checklist in checklists dropdown
  * then a popup will be shown and then click on "Save Changes" button this function 
  * will be called
  */
 public function actionAjaxCreate()
 {
     $post = Yii::$app->request->post();
     $id = $post['id'];
     $cowid = $post['cowid'];
     $content = $post['content'];
     $belong_to = $post['belong_to'];
     if ($id && $cowid && $content && $belong_to) {
         $checklistCow = new ChecklistsCow();
         $checklistCow->content = $content;
         $checklistCow->checklists_id = $id;
         $checklistCow->belong_to = $belong_to;
         $checklistCow->clients_or_webs_id = $cowid;
         $checklistCow->save();
         Yii::$app->response->format = 'json';
         return ['errors' => '', 'data' => ''];
     }
 }