mirror of
https://github.com/lkddi/Xboard.git
synced 2026-04-03 10:30:51 +08:00
fix: coupon period limit
This commit is contained in:
@@ -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()
|
||||
)
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user