28 lines
781 B
PHP
28 lines
781 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,
|
|
'points' => $this->points,
|
|
];
|
|
}
|
|
}
|