public function end()
 {
     $timeSpent = time() - $this->startTime;
     $this->session->update(['time_spent' => $timeSpent, 'num_correct' => $this->numCorrect, 'num_incorrect' => $this->numIncorrect]);
 }
 public function saveClass($topic_id, $teacher_id, $timeslots, $demo = false)
 {
     $session = new \App\Session();
     $session->topic_id = $topic_id;
     $session->teacher_id = $teacher_id;
     $session->student_id = Auth::user()->deriveable->id;
     $session->demo = $demo ? 1 : 0;
     $session->save();
     foreach ($timeslots as $key => $value) {
         \App\Timeslot::where('teacher_id', $teacher_id)->where('slot', $value)->update(['session_id' => $session->id]);
     }
     return $session;
 }