CoachApplicationDTO.php 808 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace App\DTOs;
  3. class CoachApplicationDTO
  4. {
  5. public function __construct(
  6. public readonly int $age,
  7. public readonly string $mobile,
  8. public readonly int $gender,
  9. public readonly string $workYears,
  10. public readonly string $intentionCity,
  11. public readonly array $lifePhotos,
  12. public readonly ?string $introduction = null,
  13. ) {}
  14. public static function fromRequest(array $data): self
  15. {
  16. return new self(
  17. age: $data['age'],
  18. mobile: $data['mobile'],
  19. gender: $data['gender'],
  20. workYears: $data['work_years'],
  21. intentionCity: $data['intention_city'],
  22. lifePhotos: $data['life_photos'],
  23. introduction: $data['introduction'] ?? null,
  24. );
  25. }
  26. }