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

28 lines
786 B
PHP

<?php
namespace App\Endpoint\Api\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class UserInfoResource 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 [
'nickname' => (string) $this->nickname,
'avatar' => (string) $this->avatar,
'gender' => (string) $this->gender,
'birthday' => (string) $this->birthday?->toDateString(),
'code' => (string) $this->code,
'balance' => '1000.00', //todo 用户余额
'points' => (int) $this->points,
];
}
}