mirror of
https://github.com/cedar2025/Xboard.git
synced 2025-02-13 03:58:13 -05:00
fix: coupon period limit
This commit is contained in:
parent
b3339f7fe0
commit
2fb6691ca6
@ -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;
|
||||
|
||||
@ -28,6 +31,13 @@ class CouponResource extends JsonResource
|
||||
->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()
|
||||
)
|
||||
];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user