changes
This commit is contained in:
@@ -107,23 +107,36 @@ class RestaurantApiServices
|
||||
{
|
||||
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();
|
||||
|
||||
if ($rest) {
|
||||
$rest->image = ListingImageUrl('restaurant_images', $rest->image);
|
||||
|
||||
$isFavourite = CustomerFavouriteRestaurant::where('principal_xid', $customerIamId)
|
||||
->where('restaurant_xid', $rest->id)
|
||||
->exists();
|
||||
$rest->is_favourite = $isFavourite;
|
||||
|
||||
$isRedeem = RedeemRestaurant::where('iam_principal_xid',$customerIamId)->where('manage_restaurants_xid',$rest->id)->exists();
|
||||
$rest->is_Redeemed = $isRedeem;
|
||||
$redeem = RedeemRestaurant::where('iam_principal_xid', $customerIamId)
|
||||
->where('manage_restaurants_xid', $rest->id)
|
||||
->where('is_redeem', "1")
|
||||
->first();
|
||||
|
||||
if ($redeem) {
|
||||
$rest->is_Redeemed = true;
|
||||
$rest->redeem_date = \Carbon\Carbon::parse($redeem->redeem_date)->addHours(4)->toDateTimeString();
|
||||
} else {
|
||||
$rest->is_Redeemed = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$rest) {
|
||||
return jsonResponseWithErrorMessage(__('auth.restaurant_data_not_found'), 404);
|
||||
}
|
||||
|
||||
return jsonResponseWithSuccessMessage(__('auth.data_fetched_successfully'), $rest, 200);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error('DetailRestaurant service failed: ' . $ex->getMessage());
|
||||
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
|
||||
} catch (Exception $e) {
|
||||
Log::error("Error fetching restaurant data: " . $e->getMessage());
|
||||
return jsonResponseWithErrorMessage(__('auth.something_went_wrong'), 500);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -221,11 +234,9 @@ class RestaurantApiServices
|
||||
$redeemRestaurant->save();
|
||||
|
||||
return jsonResponseWithSuccessMessageApi(__('success.restaurant_redeem'), $redeemRestaurant, 200);
|
||||
|
||||
} catch (Exception $ex) {
|
||||
Log::error('Restaurant Redeem service failed: ' . $ex->getMessage());
|
||||
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user