AuthResource.php 576 B

123456789101112131415161718192021222324
  1. <?php
  2. namespace App\Http\Resources;
  3. use Illuminate\Http\Resources\Json\JsonResource;
  4. class AuthResource extends JsonResource
  5. {
  6. /**
  7. * Transform the resource into an array.
  8. *
  9. * @return array<string, mixed>
  10. */
  11. public function toArray($request): array
  12. {
  13. return [
  14. 'access_token' => $this['access_token'],
  15. 'refresh_token' => $this['refresh_token'],
  16. 'token_type' => 'Bearer',
  17. 'expires_in' => 900, // 15 minutes
  18. 'refresh_token_expires_in' => 2592000, // 30 days
  19. ];
  20. }
  21. }