public function uncorrect($id)
 {
     $multipleAnswer = MutipleAnswer::find($id);
     if ($multipleAnswer) {
         $objanswer = CompetitionAnswer::where('mutiple_answer_id', $multipleAnswer->id)->first();
         $objanswer->delete();
         return redirect(URL::previous());
     }
     // return redirect(URL::previous());
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function answer(Request $request)
 {
     $validator = Validator::make($request->all(), ['question_id' => 'required|exists:competition_questions,id', 'group_user_id' => 'required|exists:competition_group_users,id', 'answer1' => 'unique:competition_group_answers,answer', 'answer_mm1' => 'unique:competition_group_answers,answer_mm', 'answer2' => 'unique:competition_group_answers,answer', 'answer_mm2' => 'unique:competition_group_answers,answer_mm', 'answer3' => 'unique:competition_group_answers,answer', 'answer_mm3' => 'unique:competition_group_answers,answer_mm']);
     if ($validator->fails()) {
         if ($validator->errors()->has('question_id')) {
             return response()->json($validator->errors()->first('question_id'), 400);
         }
         if ($validator->errors()->has('group_user_id')) {
             return response()->json($validator->errors()->first('group_user_id'), 400);
         }
     }
     if ($request->answer1 || $request->answer_mm1) {
         $checkExisted = CompetitionAnswer::where('id', $request->answer1_id)->first();
         if (!$checkExisted) {
             $competition_answer = new CompetitionAnswer();
             $competition_answer->question_id = $request->question_id;
             $competition_answer->competition_group_user_id = $request->group_user_id;
             $competition_answer->answer = $request->answer1;
             $competition_answer->answer_mm = $request->answer_mm1;
             $competition_answer->save();
         }
     }
     if ($request->answer2 || $request->answer_mm2) {
         $checkExisted = CompetitionAnswer::where('id', $request->answer2_id)->first();
         if (!$checkExisted) {
             $competition_answer = new CompetitionAnswer();
             $competition_answer->question_id = $request->question_id;
             $competition_answer->competition_group_user_id = $request->group_user_id;
             $competition_answer->answer = $request->answer2;
             $competition_answer->answer_mm = $request->answer_mm2;
             $competition_answer->save();
         }
     }
     if ($request->answer3 || $request->answer_mm3) {
         $checkExisted = CompetitionAnswer::where('id', $request->answer3_id)->first();
         if (!$checkExisted) {
             $competition_answer = new CompetitionAnswer();
             $competition_answer->question_id = $request->question_id;
             $competition_answer->competition_group_user_id = $request->group_user_id;
             $competition_answer->answer = $request->answer3;
             $competition_answer->answer_mm = $request->answer_mm3;
             $competition_answer->save();
         }
     }
     // Updating for Submit Anwser;
     $group_name = CompetitionGroupUser::where('id', $request->group_user_id)->pluck('group_name');
     $competition_groups = CompetitionGroupUser::where('group_name', $group_name)->where('competition_question_id', $request->question_id)->lists('id');
     if (count($competition_groups) > 0) {
         $competition_anwsers = CompetitionAnswer::where('question_id', $request->question_id)->wherein('competition_group_user_id', $competition_groups)->get();
         if (count($competition_anwsers) == count($competition_groups) * 3) {
             $group_anwser = CompetitionAnswer::where('question_id', $request->question_id)->wherein('competition_group_user_id', $competition_groups)->update(array('status' => 1));
             return response()->json('Congratulations!, your team has finished the challenge, Anwsers submitted!');
         } else {
             return response()->json('Thanks, please submit 3 answers or let other members submit answers to compelete.');
         }
     }
 }