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

26 lines
677 B
PHP

<?php
namespace App\Endpoint\Api\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class PointLogResource 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,
'action' => $this->action,
'change_points' => bcdiv($this->change_points, 100, 2),
'remark' => (string) $this->remark,
'created_at' => $this->created_at->toDateTimeString(),
];
}
}