Skip to content

Commit

Permalink
fix: coupon period limit
Browse files Browse the repository at this point in the history
  • Loading branch information
xboard committed Feb 7, 2025
1 parent b3339f7 commit 2fb6691
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/Http/Resources/CouponResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace App\Http\Resources;

use App\Models\Coupon;
use App\Services\CouponService;
use App\Services\PlanService;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;

Expand All @@ -28,6 +31,13 @@ public function toArray(Request $request): array
->map(fn(mixed $id): string => (string) $id)
->values()
->all()
),
'limit_period' => $this->when(
!empty($this->limit_period),
fn() => collect($this->limit_period)
->map(fn(mixed $period): string => (string) PlanService::convertToLegacyPeriod($period))
->values()
->all()
)
];
}
Expand Down

0 comments on commit 2fb6691

Please sign in to comment.