You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.9KB

  1. <?php
  2. namespace App\Kintone\Models;
  3. use Illuminate\Support\Carbon;
  4. /**
  5. * アプリ名 各種申請
  6. * @property string $applicationType
  7. * @property Carbon $applicationDatetime
  8. * @property string $status
  9. * @property string $applicationNo
  10. * @property string $customerCode
  11. * @property string seasonTicketContractRecordNo
  12. * @property string parkingName
  13. */
  14. abstract class GeneralApplication extends KintoneModel
  15. {
  16. const CONFIG_KEY = "KINTONE_APP_GENERAL_APPLICATION";
  17. const BASE_MODEL = GeneralApplication::class;
  18. const FIELD_APPLICATION_TYPE = "申請種別";
  19. const FIELD_APPLICATION_DATETIME = "申請日時";
  20. const FIELD_STATUS = "状況";
  21. const FIELD_APPLICATION_NO = "申請番号";
  22. const FIELD_CUSTOMER_CODE = "顧客コード";
  23. const FIELD_SEASON_TICKET_CONTRACT_RECORD_NO = "契約情報";
  24. const FIELD_PARKING_NAME = "駐車場名";
  25. protected const FIELDS = [
  26. ...parent::FIELDS,
  27. self::FIELD_APPLICATION_TYPE => FieldType::DROP_DOWN,
  28. self::FIELD_APPLICATION_DATETIME => FieldType::DATETIME,
  29. self::FIELD_STATUS => FieldType::DROP_DOWN,
  30. self::FIELD_APPLICATION_NO => FieldType::SINGLE_LINE_TEXT,
  31. self::FIELD_CUSTOMER_CODE => FieldType::NUMBER,
  32. self::FIELD_SEASON_TICKET_CONTRACT_RECORD_NO => FieldType::NUMBER,
  33. self::FIELD_PARKING_NAME => FieldType::SINGLE_LINE_TEXT,
  34. ];
  35. protected const FIELD_NAMES = [
  36. ...parent::FIELD_NAMES,
  37. ];
  38. protected const RELATIONS = [
  39. SeasonTicketContract::class,
  40. SeasonTicketContractPlan::class,
  41. Customer::class,
  42. Bank::class,
  43. ];
  44. public static function findByApplicationNo(string $applicationNo): static
  45. {
  46. return static::getAccess()->first(static::getQuery()->where(static::FIELD_APPLICATION_NO, $applicationNo));
  47. }
  48. public function getCustomer(): Customer
  49. {
  50. return Customer::findByCustomerCode($this->customerCode);
  51. }
  52. }