From e0e63c4611ee076421dcc05c8290db2d422e255e Mon Sep 17 00:00:00 2001 From: sayliraut Date: Mon, 8 Jul 2024 15:55:58 +0530 Subject: [PATCH] changes --- .../RestaurantApi_Service.php | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/app/Services/APIs/RestaurantService/RestaurantApi_Service.php b/app/Services/APIs/RestaurantService/RestaurantApi_Service.php index fdb4624..08405b4 100644 --- a/app/Services/APIs/RestaurantService/RestaurantApi_Service.php +++ b/app/Services/APIs/RestaurantService/RestaurantApi_Service.php @@ -40,28 +40,40 @@ class RestaurantApi_Service ->where('principal_xid', $userDetail->id) ->get(); - // $restaurantDetails = []; + $restaurantDetails = []; + $isActive = true; + $inactiveMessage = ""; foreach ($restaurantRoles as $restaurantRole) { $restaurant = ManageRestaurant::select('id', 'name', 'description', 'restaurant_id', 'address', 'image', 'bio', 'try_on_1', 'phone_number', 'try_on_2', 'try_on_3', 'try_on_4', 'exclusion', 'latitude', 'longtitude', 'is_active', 'created_by', 'modified_by', 'deleted_at', 'created_at', 'updated_at') ->where('id', $restaurantRole->restaurant_xid) - ->where('is_active', 1) ->first(); if ($restaurant) { $restaurant->image = ListingImageUrl('restaurant_images', $restaurant->image); $restaurant->description = strip_tags($restaurant->description); - // $restaurantDetails[] = $restaurant; + if ($restaurant->is_active == 0) { + $isActive = false; + $inactiveMessage = "Your restaurant is currently not participating in Cheers to the Season. Please reach out to contact@cheerstotheseason.com to re-enroll."; + } + + // Add restaurant details to the array + $restaurantDetails[] = $restaurant; } } // Construct response $response = [ 'user_detail' => $userDetail, - 'restaurant_details' => $restaurant, + 'restaurant_details' => $restaurantDetails, + 'is_active' => $isActive, ]; + if (!$isActive) { + $response['message'] = $inactiveMessage; + } + // Return JSON response with success message return jsonResponseWithSuccessMessageApi(__('auth.User_details_fetch'), $response, 200); } catch (Exception $ex) { @@ -74,6 +86,7 @@ class RestaurantApi_Service + public function updateRestaurantDetail($restIamId, $request) { try {