28 lines
787 B
PHP
28 lines
787 B
PHP
<?php
|
|
|
|
namespace App\Api\Resources;
|
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class AuthResource extends JsonResource
|
|
{
|
|
public function toArray($request): array
|
|
{
|
|
return [
|
|
'access_token' => 'Bearer '.$this->token,
|
|
'user_id' => $this->id,
|
|
'user_sig' => $this->user_sig,
|
|
'user_info' => [
|
|
'user_id' => $this->id,
|
|
'username' => $this->username,
|
|
'mobile' => $this->mobile,
|
|
'email' => $this->email,
|
|
'privacy' => $this->privacy ?? true,
|
|
'nickname' => $this->info->nickname,
|
|
'avatar' => $this->info->avatar,
|
|
'address' => $this->username,
|
|
],
|
|
];
|
|
}
|
|
|
|
} |