|
- <?php
-
- namespace App\Kintone\Models;
-
- use Illuminate\Support\Carbon;
-
- /**
- * アプリ名 各種申請
- * @property string $applicationType
- * @property Carbon $applicationDatetime
- * @property string $status
- * @property string $applicationNo
- * @property string $customerCode
- * @property string seasonTicketContractRecordNo
- * @property string parkingName
- */
- abstract class GeneralApplication extends KintoneModel
- {
- const CONFIG_KEY = "KINTONE_APP_GENERAL_APPLICATION";
-
- const BASE_MODEL = GeneralApplication::class;
-
- const FIELD_APPLICATION_TYPE = "申請種別";
- const FIELD_APPLICATION_DATETIME = "申請日時";
-
- const FIELD_STATUS = "状況";
- const FIELD_APPLICATION_NO = "申請番号";
- const FIELD_CUSTOMER_CODE = "顧客コード";
- const FIELD_SEASON_TICKET_CONTRACT_RECORD_NO = "契約情報";
- const FIELD_PARKING_NAME = "駐車場名";
-
- protected const FIELDS = [
- ...parent::FIELDS,
- self::FIELD_APPLICATION_TYPE => FieldType::DROP_DOWN,
- self::FIELD_APPLICATION_DATETIME => FieldType::DATETIME,
- self::FIELD_STATUS => FieldType::DROP_DOWN,
- self::FIELD_APPLICATION_NO => FieldType::SINGLE_LINE_TEXT,
- self::FIELD_CUSTOMER_CODE => FieldType::NUMBER,
- self::FIELD_SEASON_TICKET_CONTRACT_RECORD_NO => FieldType::NUMBER,
- self::FIELD_PARKING_NAME => FieldType::SINGLE_LINE_TEXT,
- ];
-
- protected const FIELD_NAMES = [
- ...parent::FIELD_NAMES,
- ];
-
- protected const RELATIONS = [
- SeasonTicketContract::class,
- SeasonTicketContractPlan::class,
- Customer::class,
- Bank::class,
- ];
-
- public static function findByApplicationNo(string $applicationNo): static
- {
- return static::getAccess()->first(static::getQuery()->where(static::FIELD_APPLICATION_NO, $applicationNo));
- }
-
- public function getCustomer(): Customer
- {
- return Customer::findByCustomerCode($this->customerCode);
- }
- }
|