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();
     }
 }
 public function selesai($id)
 {
     user_log::where('id', $id)->update(['status' => 1]);
     return redirect('mhs/materi');
 }
 public function user_selesai($id)
 {
     $log = user_log::find($id);
     $log->status = 1;
     $log->save();
     return "Selamat, anda berhasil mengerjakan latihan";
 }