From 75ebf4bb4963b89039969ee2c750c71f40e3861b Mon Sep 17 00:00:00 2001 From: Nisay Date: Tue, 27 Jun 2023 13:07:51 +0330 Subject: [PATCH] add discount and dispros, fardad --- app/Http/Controllers/WebsiteController.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/WebsiteController.php b/app/Http/Controllers/WebsiteController.php index dcc85bf..b534ef1 100755 --- a/app/Http/Controllers/WebsiteController.php +++ b/app/Http/Controllers/WebsiteController.php @@ -62,9 +62,14 @@ class WebsiteController extends Controller } $cats = Cat::whereNull('parent_id')->limit(6)->get(); $sliders = Slider::whereActive(true)->limit(5)->get(); - $vid = Clip::latest()->where('active', 1)->first(); +// $vid = Clip::latest()->where('active', 1)->first(); - return view('website.index', compact('cats', 'sliders', 'vid')); + $discount = Discount::whereNotNull('expire') + ->where('expire', '>', \DB::raw('NOW()')) + ->whereNotNull('product_id')->pluck('product_id')->toArray(); + $disPros = Product::whereIn('id', $discount)->get(); + + return view('website.index', compact('cats', 'sliders', 'disPros')); } public function cat(Cat $cat, Request $request)