$homeBanner = App\Gallery::find(intval($configuracion->home_slider)); $homeCollectionBanner = App\Gallery::tag('home_collection_banner'); return view('pages.home', ['products' => App\Product::with('colors', 'category')->orderBy('created_at', 'desc')->take(3)->get(), 'news' => App\News::orderBy('created_at', 'desc')->take(2)->get(), 'home_banner' => $homeBanner, 'home_collection_banner' => $homeCollectionBanner]); }); Route::get('/productos', function (Request $request) { $category = App\Category::with('gallery')->where('slug', 'productos')->first(); $productos = App\Product::with('colors'); $search = $request->input('s'); if (isset($search) && !empty($search)) { $productos->where('title', 'like', "%{$search}%")->orWhere('subtitle', 'like', "%{$search}%"); } $productos = $productos->paginate(6); return view('pages.catalog', ['categoria' => $category, 'productos' => $productos])->render(); }); Route::get('/productos/{categoria}', function (Request $request, $categoria) { $category = App\Category::with('gallery')->where('slug', $categoria)->first(); $productos = App\Product::with('colors', 'category')->where('category_id', $category->id); $search = $request->input('s'); if (isset($search) && !empty($search)) { $productos->where('title', 'like', "%{$search}%")->orWhere('subtitle', 'like', "%{$search}%"); } $productos = $productos->paginate(6); return view('pages.catalog', ['categoria' => $category, 'productos' => $productos])->render(); }); Route::get('/productos/{categoria}/{producto}', function ($cid, $pid) { $producto = App\Product::with('colors', 'category')->where('slug', $pid)->first(); if (empty($producto->tags)) { $series = [$producto]; } else { $series = App\Product::with('colors')->where('tags', $producto->tags)->get(); }