/**
  * Function to get the list of approved Interviews
  * @param Request $request
  */
 public function getApprovedInterviews(Request $request)
 {
     header('Access-Control-Allow-Origin: *');
     $interview = new Interview();
     $user = new User();
     $category = new InterviewCategorie();
     $firstAnswer = new QuestionAnswer();
     $userInterview = array();
     $approvedInterviews = $interview->getApprovedInterviews();
     foreach ($approvedInterviews as $approvedInterview) {
         $interviewJSON = new UserInterviews();
         $interviewedUser = $user->getUserByID($approvedInterview->userID);
         $interviewJSON->interviewID = $approvedInterview->interviewID;
         $interviewJSON->fullName = $interviewedUser->fullname;
         $interviewJSON->profilePic = $interviewedUser->profilePic;
         $interviewJSON->date = $approvedInterview->updated_at;
         $interviewJSON->category = $category->getCategory($approvedInterview->categoryID)->category;
         $interviewJSON->content = $firstAnswer->getAnswer($approvedInterview->interviewID, 1);
         array_push($userInterview, $interviewJSON);
     }
     echo json_encode($userInterview);
 }
 /**
  * Gives the list of all the categories
  * @return array|\Illuminate\Database\Eloquent\Collection|static[]
  */
 public function getCategories()
 {
     $categories = array();
     $return = "none";
     $categories = InterviewCategorie::all();
     if (sizeof($categories) != 0) {
         $return = $categories;
     }
     return $categories;
 }
 /**
  * Function to add the category to the main database by admin only
  * ADMIN ONLY
  * @param Request $request
  */
 public function addCategoryAdmin(Request $request)
 {
     header('Access-Control-Allow-Origin: *');
     $interviewCategorie = new InterviewCategorie();
     echo $interviewCategorie->addCategoryAdmin($request->input('categoryName'), $request->input('userEmail'));
 }