public function show($id)
 {
     $user = $this->getAll();
     $status_latihan = user_log::where('kd_materi', $user->rekomendasi_materi)->where('kd_belajar', 'L')->where('username', $user->username)->first();
     if ($status_latihan == null | empty($status_latihan)) {
         $log = array('username' => $user->username, 'kd_materi' => $id, 'kd_belajar' => 'L', 'skor' => 1, 'status' => 0);
         user_log::create($log);
         $status_latihan = user_log::where('kd_materi', $user->rekomendasi_materi)->where('kd_belajar', 'L')->where('username', $user->username)->first();
     }
     $lat = latihan::where('kd_materi', $id)->with('materi')->first();
     if ($lat == null | empty($lat)) {
         return "Latihan Belum ada";
     } else {
         $lat['id_log'] = $status_latihan->id;
         if ($status_latihan->status == "1") {
             $lat['selesai'] = true;
         }
         return view('cekjava', $lat);
     }
 }
 public function selesai($id)
 {
     user_log::where('id', $id)->update(['status' => 1]);
     return redirect('mhs/materi');
 }
 public function update_user($par = array())
 {
     $user = $this->getAll();
     if ($par['z'] >= 70) {
         $log = array('username' => $user->username, 'kd_materi' => $par['kd_materi'], 'kd_belajar' => 'N', 'skor' => $par['z'], 'status' => 1);
         user_log::create($log);
         $ambil = user::where('username', $user->username)->first();
         $rek = $ambil->rekomendasi_materi + 1;
         user::where('username', $user->username)->update(['rekomendasi_materi' => $rek]);
         soal_temp::where('username', $user->username)->delete();
     } else {
         user_log::where('username', $user->username)->where('kd_materi', $par['kd_materi'])->delete();
     }
 }