orderBy('order', 'ASC')->get(); $ranges = Ranges::where('status', 1)->get(); $meatTypes = MeatTypes::where('status', 1)->get(); $moments = Moments::where('status', 1)->get(); return view('front.products.index', compact('productsSlides', 'ranges', 'meatTypes', 'moments')); } public function filter($slug) { $type = explode('/', Route::getCurrentRoute()->uri)[1]; switch ($type) { case 'gamme': $range = Ranges::where([['slug', $slug], ['status', 1]])->first(); if (!$range) abort(404); dd('Gamme : ' . $range->name); break; case 'type-viande': $meatType = MeatTypes::where([['slug', $slug], ['status', 1]])->first(); if (!$meatType) abort(404); dd('Type de viande : ' . $meatType->name); break; case 'moment-conso': $moment = Moments::where([['slug', $slug], ['status', 1]])->first(); if (!$moment) abort(404); dd('Moment consomation : ' . $moment->title); break; default: abort(404); break; } } public function departaimants() { $products = Products::where([['status', 1], ['departaimants', 1]])->get(); // TODO : Rediriger si on était déjà sur departaimants dd("Produits departaimants"); } }