Dto.stub 643 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace App\DataTransferObjects;
  3. use App\Http\Requests\{{modelName}}Request;
  4. class {{modelName}}Dto
  5. {
  6. public function __construct(
  7. // Add properties here
  8. ) {
  9. }
  10. public static function fromRequest({{modelName}}Request $request): self
  11. {
  12. return new self(
  13. // Initialize properties from $request
  14. );
  15. }
  16. public static function fromArray(array $data): self
  17. {
  18. return new self(
  19. // Initialize properties from $data
  20. );
  21. }
  22. public function toArray(): array
  23. {
  24. return [
  25. // Convert properties to array
  26. ];
  27. }
  28. }