/** * Function to set the Question,answer,interviewID,questionOrder to the database * @param $question * @param $answer * @param $interviewID * @param $qOrder * @return string */ public function setQuestionAnswer($question, $answer, $interviewID, $qOrder) { $return = 'success'; $interview = Interview::where('interviewID', $interviewID)->get(); if (sizeof($interview) == 1) { $this->question = $question; $this->answer = $answer; $this->interviewID = $interviewID; $this->qOrder = $qOrder; $this->save(); } else { $return = 'failure'; } return $return; }
/** * Function to get the interview based on Interview ID * @param $interviewID * @return string */ public function getInterview($interviewID) { $questionAnswer = new QuestionAnswer(); $userInterview = new UserInterview(); $interview = Interview::where('interviewID', $interviewID)->get(); $user = new User(); $interviewUser = $user->getUserByID($interview[0]->userID); $category = new InterviewCategorie(); $category = $category->getCategory($interview[0]->categoryID); $userInterview->questionAnswers = $questionAnswer->getAllQuestions($interviewID); $userInterview->userFullname = $interviewUser->fullname; $userInterview->userProfilePic = $interviewUser->profilePic; $userInterview->interviewCategory = $category->category; return json_encode($userInterview); }