where('star', 1)->get(); $slider = Slider::where('slug', 'home')->first(); $slides = $slider->showable_slides; $quickorder_ranges = Range::with('products')->get(); foreach ($quickorder_ranges as $range) { foreach ($range->products as $product) { $product->calculatedPrices = $product->getCalcPrices(); } } return view('home', compact('content', 'products', 'slides', 'quickorder_ranges')); } /** * Display a static page * * @param \Illuminate\Http\Request $request * @param \App\Models\StaticPage $content * @return \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory * @throws \RuntimeException If the static page type is not handled. */ public function displayStaticPage(Request $request, StaticPage $content) { switch ($content->type) { case StaticPageType::legals(): return view('legal-notice', compact('content')); case StaticPageType::sellconditions(): return view('terms', compact('content')); case StaticPageType::contact(): return app(ContactController::class)->contact($request); case StaticPageType::confidentiality(): return view('privacy', compact('content')); case StaticPageType::faq(): return view('faq', compact('content')); default: throw new \RuntimeException("Unhandled static page {$content->type->label}"); } } }