collections->getById($collection); abort_if($collectionData === null, Response::HTTP_NOT_FOUND); $listing = CategoryListing::fromRequest(request()); $filters = $listing->filters($collectionData['id']); $perPage = 12; // One call for both the product page and the price slider's bounds — // see ProductService::list()'s own docblock for why a controller no // longer orchestrates list() + priceSliderBounds() itself. $listingResult = $this->products->list( filters: $filters, perPage: $perPage, page: $listing->page, sort: $listing->sort, ); $products = $listingResult->products ->through(fn (array $product) => ProductCard::fromIndexed($product)) ->appends($listing->query(['page' => null])); $priceBounds = $listingResult->priceBounds; return view('category.show', [ 'collection' => $collectionData, 'products' => $products, 'listing' => $listing, 'priceFloor' => $priceBounds->floor, 'priceCeil' => $priceBounds->ceil, 'priceFiltered' => $priceBounds->filtered, ]); } }