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

27 lines
741 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,
'is_company' => (boolean) $this->is_company
];
}
}