Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

DocumentColumnLabelDTO.php 1.0KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace App\DTO;
  3. use App\Models\Setting\DocumentDefault;
  4. readonly class DocumentColumnLabelDTO
  5. {
  6. public function __construct(
  7. public string $items = 'Items',
  8. public string $units = 'Quantity',
  9. public string $price = 'Price',
  10. public string $amount = 'Amount',
  11. ) {}
  12. public function toArray(): array
  13. {
  14. return [
  15. 'items' => $this->items,
  16. 'units' => $this->units,
  17. 'price' => $this->price,
  18. 'amount' => $this->amount,
  19. ];
  20. }
  21. public static function fromModel(DocumentDefault $settings): self
  22. {
  23. return new self(
  24. items: $settings->resolveColumnLabel('item_name', 'Items'),
  25. units: $settings->resolveColumnLabel('unit_name', 'Quantity'),
  26. price: $settings->resolveColumnLabel('price_name', 'Price'),
  27. amount: $settings->resolveColumnLabel('amount_name', 'Amount'),
  28. );
  29. }
  30. public static function getDefaultLabels(): self
  31. {
  32. return new self;
  33. }
  34. }