/** * Get videos in a particular category * * @param $name * @return \Illuminate\Http\Response */ public function getVideoInCategory($name) { $recent = $this->recentVideos(); $categories = $this->getCategory(); $category = Category::where('name', $name)->first(); $videos = Video::where('category_id', $category->id)->orderBy('created_at', 'desc')->paginate(9); return view('pages.category', compact('videos', 'categories', 'recent')); }