領収証発行サービス
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.

47 rindas
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. }