From 1ae8deca995678233fb6537eef6d8454f32ca841 Mon Sep 17 00:00:00 2001 From: xboard Date: Fri, 24 Jan 2025 02:26:22 +0800 Subject: [PATCH] feat(coupon): enhance theme compatibility by converting plan IDs to strings --- app/Models/Coupon.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/Models/Coupon.php b/app/Models/Coupon.php index 089e2ef..8313172 100644 --- a/app/Models/Coupon.php +++ b/app/Models/Coupon.php @@ -23,4 +23,18 @@ class Coupon extends Model return PlanService::getPeriodKey($item); })->toArray(); } + + public function getLimitPlanIdsAttribute($value) + { + $planIds = json_decode($value, true); + + if (blank($planIds)) { + return null; + } + + return collect($planIds) + ->map(fn($id) => (string) $id) + ->values() + ->all(); + } }