public function hapusSoal(Request $request) { if ($request->ajax()) { $soal = Soal::findOrFail($request->id); $soal->delete(); return response('deleted'); } }
public function hapus($id) { $soal = Soal::find($id); $success = $soal->delete(); if (!$success) { return Response::json("error deleting", 500); } return Response::json("success", 200); }
public function jawaban_asli($id, $id_soal) { $jawaban = Soal::where('id', '=', $id_soal)->get(); return $jawaban; }
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."; } }