示例#1
0
 public function storeActivity($lessonId)
 {
     $this->userOwnsLesson($lessonId);
     $score = $this->getCorrectAnswerCount(Lesson::findOrFail($lessonId)->lessonWords()->get());
     auth()->user()->activities()->create(['lesson_id' => $lessonId, 'content' => 'Finished an exam with a score of ' . $score->correct . '/' . $score->total, 'activity_type' => config()->get('activity_type.EXAM_TAKEN')]);
     return redirect('results/' . $lessonId);
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit(Request $request, $id)
 {
     if (null !== Session::get('active_tab')) {
         $active_tab = Session::get('active_tab');
     } else {
         $active_tab = 'links';
     }
     $lesson = Lesson::findOrFail($id);
     return view('site.lessons.edit')->with('lesson', $lesson)->with('product_id', $lesson->product->id)->with('active_tab', $active_tab);
 }