public function getPurchase() { if (!Auth::user()) { return redirect('register'); } $courses = Course::all(); return view('user.purchase', compact('courses')); }
public function show(Request $request, $courseSlug, $slug) { if ($request->user() and $request->user()->hasRole('student')) { $lesson = Lesson::where('slug', $slug)->firstOrFail(); $courses = Course::where('published', 1)->get(); return view('lesson.show', compact('lesson', 'courses')); } else { return redirect('purchase'); } return redirect('login')->withErrors('You must be logged in to view this lesson.'); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $courses = Course::where('published', 1)->orderBy('id', 'desc')->take(18)->get(); return view('base.home', compact('courses')); }
/** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { $courses = Course::all(); return view('admin.post.create', compact('courses')); }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { $lesson = Lesson::findOrFail($id); $courses = Course::all(); return view('admin.lesson.show', compact('lesson', 'courses')); }
/** * Update the specified resource in storage. * * @param Request $request * @param int $id * @return Response */ public function update(Request $request, $id) { $courses = Course::all(); }
public function show($slug) { $course = Course::where('slug', $slug)->firstOrFail(); $courses = Course::where('published', 1)->get(); return view('course.show', compact('course', 'courses')); }
/** * Run the database seeds. * * @return void */ public function run() { Course::truncate(); factory(Course::class, 100)->create(); }