/** * 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')); }
/** * 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'); }
public function show($slug) { $course = Course::where('slug', $slug)->firstOrFail(); return view('course.show', compact('course')); }