領収証発行サービス
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

47 lignes
898B

  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Support\Str;
  4. use App\Codes\Custom;
  5. class Contract extends AppModel
  6. {
  7. const COL_NAME_NAME = 'name';
  8. const COL_NAME_CUSTOM = 'custom';
  9. public function getModelName(): string
  10. {
  11. return "契約";
  12. }
  13. public function includeCustom(string $target): bool
  14. {
  15. return in_array($target, $this->custom(), true);
  16. }
  17. /**
  18. * @return Custom[]
  19. */
  20. public function custom(): array
  21. {
  22. $custom = data_get($this, self::COL_NAME_CUSTOM);
  23. if ($custom) {
  24. $strList = explode(',', $custom);
  25. $ret = [];
  26. foreach ($strList as $str) {
  27. $c = Custom::tryFrom($str);
  28. if ($c !== null) {
  29. $ret[] = $c;
  30. }
  31. }
  32. return $ret;
  33. } else {
  34. return [];
  35. }
  36. }
  37. }