Example #1
0
 public function hapusSoal(Request $request)
 {
     if ($request->ajax()) {
         $soal = Soal::findOrFail($request->id);
         $soal->delete();
         return response('deleted');
     }
 }
Example #2
0
 public function hapus($id)
 {
     $soal = Soal::find($id);
     $success = $soal->delete();
     if (!$success) {
         return Response::json("error deleting", 500);
     }
     return Response::json("success", 200);
 }
Example #3
0
 public function jawaban_asli($id, $id_soal)
 {
     $jawaban = Soal::where('id', '=', $id_soal)->get();
     return $jawaban;
 }
Example #4
0
 public function postAnswer(Request $request)
 {
     if ($request->ajax()) {
         $id_soal = $request->id_soal;
         $answer = $request->answer;
         $soal = Soal::find($id_soal);
         $opsiBenar = $soal->opsiBenar;
         if ($answer == $opsiBenar) {
             return "answerRight";
         } else {
             return "answerWrong";
         }
     } else {
         return "Hey, seems you are not using ajax, maybe your browser does not support this.";
     }
 }