← All changes
|
app/Http/Controllers/FrontendControllers/CustomerSubscriptionController.php
+2
-3
1.6.5
→
1.7.0
View file →
| @@ -51,12 +51,11 @@ | ||
| 51 | 51 | |
| 52 | 52 | // Query the Subscription model to retrieve subscriptions for the logged-in customer |
| 53 | 53 | // Include associated order and product data using 'with' for eager loading |
| 54 | 54 | // Sort the results by 'id' in descending order and fetch the data |
| 55 | - $subscriptions = Subscription::query() | |
| 55 | + $subscriptions = Subscription::visibleToCustomer() | |
| 56 | 56 | ->where('customer_id', $customer->id) |
| 57 | 57 | ->with(['product']) |
| 58 | - ->whereNotIn('status', [Status::SUBSCRIPTION_PENDING, Status::SUBSCRIPTION_INTENDED]) | |
| 59 | 58 | ->orderBy('id', 'desc') |
| 60 | 59 | ->paginate($perPage, ['*'], 'page', $page); |
| 61 | 60 | |
| 62 | 61 | |
| @@ -98,9 +97,9 @@ | ||
| 98 | 97 | ->with(['product', 'variation', 'billing_addresses']) |
| 99 | 98 | ->where('uuid', $subscription_uuid) |
| 100 | 99 | ->first(); |
| 101 | 100 | |
| 102 | - if (!$subscription || in_array($subscription->status, [Status::SUBSCRIPTION_PENDING, Status::SUBSCRIPTION_INTENDED])) { | |
| 101 | + if (!$subscription || !$subscription->isVisibleToCustomer()) { | |
| 103 | 102 | return $this->sendError([ |
| 104 | 103 | 'message' => __('Subscription not found', 'fluent-cart') |
| 105 | 104 | ]); |
| 106 | 105 | } |