24 lines
545 B
PHP
24 lines
545 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Http\Resources\oAuth;
|
||
|
|
||
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||
|
|
||
|
class Token extends JsonResource
|
||
|
{
|
||
|
/**
|
||
|
* Transform the resource into an array.
|
||
|
*
|
||
|
* @param \Illuminate\Http\Request $request
|
||
|
* @return array
|
||
|
*/
|
||
|
public function toArray($request)
|
||
|
{
|
||
|
return [
|
||
|
'access_token' => $this->token,
|
||
|
'token_type' => 'bearer',
|
||
|
'expires_in' => strtotime($this->expires_at)-time(),
|
||
|
'refresh_token' => $this->refreshToken
|
||
|
];
|
||
|
}
|
||
|
}
|