From 728f1fbceb9bef13ba908cee02845b2159f91a69 Mon Sep 17 00:00:00 2001 From: sayaliparab Date: Wed, 10 Jul 2024 14:53:23 +0530 Subject: [PATCH] FAQ_sub --- .../Admin/ManageNotificationsController.php | 4 ++++ .../APIs/CustomerAPIs/RestaurantApiServices.php | 15 ++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Admin/ManageNotificationsController.php b/app/Http/Controllers/Admin/ManageNotificationsController.php index ef0d09b..30baad0 100644 --- a/app/Http/Controllers/Admin/ManageNotificationsController.php +++ b/app/Http/Controllers/Admin/ManageNotificationsController.php @@ -26,6 +26,7 @@ class ManageNotificationsController extends Controller if ($activeQuery == 4) { // for customer $notifications = NotificationDetails::with('Notification') + ->where('is_active', 1) ->whereHas('Notification', function ($query) { $query->where('principal_type_xid', 3); }) @@ -34,6 +35,7 @@ class ManageNotificationsController extends Controller ->get(); } else if ($activeQuery == 3) { // for restaurant $notifications = NotificationDetails::with('Notification') + ->where('is_active', 1) ->whereHas('Notification', function ($query) { $query->where('principal_type_xid', 4); }) @@ -44,6 +46,7 @@ class ManageNotificationsController extends Controller // return $notifications; } else { $notificationsOfType3 = NotificationDetails::with('Notification') + ->where('is_active', 1) ->whereHas('Notification', function ($query) { $query->where('principal_type_xid', 3); }) @@ -52,6 +55,7 @@ class ManageNotificationsController extends Controller ->get(); $notificationsOfType4 = NotificationDetails::with('Notification') + ->where('is_active', 1) ->whereHas('Notification', function ($query) { $query->where('principal_type_xid', 4); }) diff --git a/app/Services/APIs/CustomerAPIs/RestaurantApiServices.php b/app/Services/APIs/CustomerAPIs/RestaurantApiServices.php index 42e2129..5c93021 100644 --- a/app/Services/APIs/CustomerAPIs/RestaurantApiServices.php +++ b/app/Services/APIs/CustomerAPIs/RestaurantApiServices.php @@ -112,8 +112,7 @@ class RestaurantApiServices public function DetailRestaurant($customerIamId, $id) { try { - $rest = ManageRestaurant::with('operatingHours')->select('id', 'short_id', 'name', 'description', 'restaurant_id', 'address', 'image', 'bio', 'try_on_1', 'try_on_2', 'try_on_3', 'try_on_4', 'exclusion', 'latitude', 'longtitude')->where('short_id', $id)->where('is_active', '1')->first(); - + $rest = ManageRestaurant::with('operatingHours')->select('id', 'short_id', 'name', 'description', 'restaurant_id', 'address', 'image', 'bio', 'try_on_1', 'try_on_2', 'try_on_3', 'try_on_4', 'exclusion', 'latitude', 'longtitude','state_xid')->where('short_id', $id)->where('is_active', '1')->first(); if ($rest) { $rest->image = ListingImageUrl('restaurant_images', $rest->image); @@ -127,9 +126,19 @@ class RestaurantApiServices ->where('is_redeem', "1") ->first(); + $Timeinterval = TimeInterval::where('manage_state_xid', $rest->state_xid)->first(); + $restTime = RestaurantTimeInterval::where('manage_restaurants_xid', $rest->id)->first(); + + $timeIntervalHours = $Timeinterval->time_hours; + $restTimeHours = $restTime->time_hours; + + $greaterTime = max($timeIntervalHours, $restTimeHours); + + + if ($redeem) { $rest->is_Redeemed = true; - $rest->redeem_date = \Carbon\Carbon::parse($redeem->redeem_date)->addHours(4)->toDateTimeString(); + $rest->redeem_date = \Carbon\Carbon::parse($redeem->redeem_date)->addHours($greaterTime)->toDateTimeString(); } else { $rest->is_Redeemed = false; $rest->redeem_date = null;