first(); // Star products. $products = Product::where('status', 1)->where('star', 1)->get(); $slider = Slider::where('slug', 'home')->first(); $slides = $slider->showableSlides; // Display only slides visible to connected customers. $isCustomerConnected = Auth::guard('customer')->check(); if (!$isCustomerConnected) { $slides = $slides->where('connected', false); } $quickorder_ranges = Range::where('status', 1)->get(); foreach ($quickorder_ranges as $range) { foreach ($range->products()->where('status', 1) as $product) { $product->calculatedPrices = $product->getCalcPrices(); } } return view('home', compact('content', 'products', 'slides', 'quickorder_ranges')); } }