mirror of
https://github.com/cedar2025/Xboard.git
synced 2025-03-14 00:38:13 -04:00
Compare commits
2 Commits
b3339f7fe0
...
8e5732d857
Author | SHA1 | Date | |
---|---|---|---|
![]() |
8e5732d857 | ||
![]() |
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;
|
||||
|
||||
@ -22,13 +25,14 @@ class CouponResource extends JsonResource
|
||||
{
|
||||
return [
|
||||
...$this->resource->toArray(),
|
||||
'limit_plan_ids' => $this->when(
|
||||
!empty($this->limit_plan_ids),
|
||||
fn() => collect($this->limit_plan_ids)
|
||||
->map(fn(mixed $id): string => (string) $id)
|
||||
->values()
|
||||
->all()
|
||||
)
|
||||
'limit_plan_ids' => empty($this->limit_plan_ids) ? null : collect($this->limit_plan_ids)
|
||||
->map(fn(mixed $id): string => (string) $id)
|
||||
->values()
|
||||
->all(),
|
||||
'limit_period' => empty($this->limit_period) ? null : collect($this->limit_period)
|
||||
->map(fn(mixed $period): string => (string) PlanService::convertToLegacyPeriod($period))
|
||||
->values()
|
||||
->all(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user