Esempio n. 1
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $lesson = Lesson::findOrFail($id);
     // Go from HTML to Markdown
     $converter = new HtmlConverter();
     $description = $converter->convert($lesson->description);
     $courses = Course::all();
     return view('admin.lesson.edit', compact('lesson', 'courses', 'description'));
 }
Esempio n. 2
0
 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(CourseUpdateRequest $request, $id)
 {
     $course = Course::find($id);
     $course->name = $request->name;
     $course->summary = $request->summary;
     $course->setDescriptionAttribute($request->description);
     $course->skill = $request->skill;
     $course->length = $request->length;
     $course->published = $request->published;
     $course->video = $request->video;
     $course->status = $request->status;
     $course->save();
     return redirect()->route('admin.course.edit', $id)->withSuccess('Course Update');
 }
Esempio n. 3
0
 public function show($slug)
 {
     $course = Course::where('slug', $slug)->firstOrFail();
     return view('course.show', compact('course'));
 }