From 66f91908ce851f034e79a769591f7a1fc6b4a851 Mon Sep 17 00:00:00 2001 From: xboard <147830212+cedar2025@users.noreply.github.com> 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(); + } }