File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed
app/Http/Resources/V1/Auth Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -49,13 +49,16 @@ public function toArray(Request $request): array
4949
5050 return array_values (array_unique ($ permissionSlugs ));
5151 }),
52- $ this ->mergeWhen (isset ($ this ->resource ->access_token ), [
53- 'access_token ' => $ this ->resource ->access_token ,
54- 'refresh_token ' => $ this ->resource ->refresh_token ,
55- 'access_token_expires_at ' => $ this ->resource ->access_token_expires_at ?->toISOString(),
56- 'refresh_token_expires_at ' => $ this ->resource ->refresh_token_expires_at ?->toISOString(),
57- 'token_type ' => 'Bearer ' ,
58- ]),
52+ $ this ->mergeWhen (
53+ array_key_exists ('access_token ' , $ this ->resource ->getAttributes ()),
54+ fn () => [
55+ 'access_token ' => $ this ->resource ->getAttributes ()['access_token ' ],
56+ 'refresh_token ' => $ this ->resource ->getAttributes ()['refresh_token ' ] ?? null ,
57+ 'access_token_expires_at ' => optional ($ this ->resource ->getAttributes ()['access_token_expires_at ' ] ?? null )?->toISOString(),
58+ 'refresh_token_expires_at ' => optional ($ this ->resource ->getAttributes ()['refresh_token_expires_at ' ] ?? null )?->toISOString(),
59+ 'token_type ' => 'Bearer ' ,
60+ ]
61+ ),
5962 ];
6063 }
6164}
You can’t perform that action at this time.
0 commit comments