public function createFollowup() { $inputs = Input::all(); if ($inputs['followupType'] == 'COMPLAINTS') { $createComplaint = Complaint::createComplaint($inputs); $input['complaint_id'] = $createComplaint->id; } else { if ($inputs['followupType'] == 'RETENTION') { $createRetention = Retention::createRetention($inputs); $input['retention_id'] = $createRetention->id; } else { if ($inputs['followupType'] == 'INQUIRY') { $createInquiry = Inquiry::createInquiry($inputs); $input['inquiry_id'] = $createInquiry->id; } } } //create comment if (isset($createComplaint)) { $input['customerId'] = $inputs['customer_id']; $input['student_id'] = $inputs['student_id']; $input['followupType'] = $inputs['followupType']; $input['commentStatus'] = $inputs['followupstatus']; $input['commentText'] = $inputs['otherCommentTxtarea']; $input['commentType'] = $inputs['comment_type']; $input['reminderDate'] = $inputs['remindDate']; $comments_data = Comments::addComments($input); } if (isset($createRetention)) { $input['customerId'] = $inputs['customer_id']; $input['student_id'] = $inputs['student_id']; $input['followupType'] = $inputs['followupType']; $input['commentStatus'] = $inputs['followupstatus']; $input['commentText'] = $inputs['otherCommentTxtarea']; $input['commentType'] = $inputs['comment_type']; $input['reminderDate'] = $inputs['remindDate']; $comments_data = Comments::addComments($input); } if (isset($createInquiry)) { $input['customerId'] = $inputs['customer_id']; $input['followupType'] = $inputs['followupType']; $input['commentStatus'] = $inputs['followupstatus']; $input['commentText'] = $inputs['otherCommentTxtarea']; $input['commentType'] = $inputs['comment_type']; $input['reminderDate'] = $inputs['remindDate']; $comments_data = Comments::addComments($input); } if ($comments_data) { return Response::json(array('status' => 'success')); } else { return Response::json(array('status' => 'failure')); } }