where('slug', $slug)->firstOrFail(); $otherProductModels = $productModel->range->products() ->where('id', '!=', $productModel->id) ->where('published', true) ->inRandomOrder() ->get(); return view('fo.pages.products.show', compact('productModel', 'otherProductModels')); } /** * Get filtered products. * * @return \Illuminate\Http\JsonResponse */ public function productsFiltered(): \Illuminate\Http\JsonResponse { $productModels = Product::query() ->where('published', true) ->where('range_id', request()->range_id) ->orderBy('order', 'asc') ->get(); $productModels = CollectionHelper::paginateManually($productModels, 12, request()->page); return response()->json($productModels); } }