6
0
Fork 0
jiqu-library-server/app/Endpoint/Api/Http/Resources/UserCouponResource.php

28 lines
791 B
PHP

<?php
namespace App\Endpoint\Api\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class UserCouponResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
*/
public function toArray($request)
{
return [
'id' => $this->id,
'name' => $this->coupon_name,
'type' => $this->coupon_type,
'amount' => $this->coupon_amount_format,
'threshold' => $this->coupon_threshold_format,
'use_start_at' => $this->use_start_at->toDateTimeString(),
'use_end_at' => $this->use_end_at->toDateTimeString(),
];
}
}