| 12345678910111213141516171819202122232425262728293031323334 |
- <?php
- namespace App\DTO;
- use App\Http\Requests\RefreshTokenRequest;
- readonly class RefreshTokenDTO
- {
- public function __construct(
- public string $token,
- ) {
- }
- public static function fromRequest(RefreshTokenRequest $request): self
- {
- return new self(
- token: $request->validated(key: 'refresh_token'),
- );
- }
- public static function fromArray(array $data): self
- {
- return new self(
- token: $data['refresh_token'],
- );
- }
- public function toArray(): array
- {
- return [
- 'refresh_token' => $this->token,
- ];
- }
- }
|