/**
  * Store a newly created resource in storage.
  *
  * @param CreateLessonRequest $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function store(CreateLessonRequest $request)
 {
     $lesson = new Lesson();
     $lesson->fill($request->all());
     $lesson->user_id = Auth::user()->id;
     $lesson->save();
     $message = trans('messages.created_successfully_lesson');
     Flash::success($message);
     return redirect()->route('teacher.units.show', $lesson->unit);
 }
Пример #2
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(CreateLessonRequest $request)
 {
     $input = $request->all();
     $lesson = Lesson::create($input);
     $links = $request->input('links');
     if ($links) {
         $this->sync($lesson, $links);
     }
     Flash::message('Lesson saved successfully.');
     return redirect(route('lessons.edit', [$lesson->id]));
 }
 /**
  * Update the specified Lesson in storage.
  *
  * @param  int    $id
  * @param CreateLessonRequest $request
  *
  * @return Response
  */
 public function update($id, CreateLessonRequest $request)
 {
     /** @var Lesson $lesson */
     $lesson = Lesson::find($id);
     if (empty($lesson)) {
         Flash::error('Lesson not found');
         return redirect(route('admin.lessons.index'));
     }
     $lesson->fill($request->all());
     $lesson->save();
     Flash::message('Lesson updated successfully.');
     return redirect(route('admin.lessons.index'));
 }