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(); + } }