Ejemplo n.º 1
0
 public function addIntroVisit()
 {
     $inputs = Input::all();
     $result = IntroVisit::addSchedule($inputs);
     $commentsInput['customerId'] = $inputs['customerId'];
     $commentsInput['student_id'] = $inputs['studentIdIntroVisit'];
     $commentsInput['introvisit_id'] = $result->id;
     $commentsInput['commentText'] = Config::get('constants.IV_SCHEDULED_COMMENT') . '  ' . $inputs['customerCommentTxtarea'];
     $commentsInput['commentStatus'] = 'ACTIVE/SCHEDULED';
     $commentsInput['commentType'] = $inputs['commentType'];
     $commentsInput['followupType'] = $inputs['followupType'];
     //$commentsInput['reminderDate']   = date('Y-m-d', strtotime($inputs['reminderTxtBox']));
     $iv_date = Carbon::createFromFormat('m/d/Y', $inputs['introVisitTxtBox']);
     if ($iv_date->eq(carbon::now())) {
         Comments::addComments($commentsInput);
     } else {
         $iv_date->subDay();
         $commentsInput['reminderDate'] = $iv_date->toDateString();
         Comments::addComments($commentsInput);
     }
     if ($result) {
         return Response::json(array("status" => "success"));
     }
     return Response::json(array("status" => "failed"));
 }