mirror of
https://github.com/lkddi/Xboard.git
synced 2026-04-14 19:40:53 +08:00
feat: add user deletion functionality and fix known issues
This commit is contained in:
34
app/Http/Resources/CouponResource.php
Normal file
34
app/Http/Resources/CouponResource.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/**
|
||||
* 优惠券资源类
|
||||
*
|
||||
* @property array|null $limit_plan_ids 限制可用的套餐ID列表
|
||||
*/
|
||||
class CouponResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* 将资源转换为数组
|
||||
*
|
||||
* @param Request $request 请求实例
|
||||
* @return array<string, mixed> 转换后的数组
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
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()
|
||||
)
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user