categoryRepo = $categoryRepository; } /** * Find the category via the slug * * @param string $slug * @return \App\Shop\Categories\Category */ public function getCategory(string $slug) { $category = $this->categoryRepo->findCategoryBySlug(['slug' => $slug]); $repo = new CategoryRepository($category); $products = $repo->findProducts()->where('status', 1)->all(); return view('front.categories.category', [ 'category' => $category, 'products' => $repo->paginateArrayResults($products, 20) ]); } }