'integer', 'fiscal_start_day' => 'integer', 'default_annual_leave' => 'integer', 'additional_leave_per_year' => 'integer', 'max_annual_leave' => 'integer', 'carry_over_enabled' => 'boolean', 'carry_over_max_days' => 'integer', 'carry_over_expiry_months' => 'integer', ]; // ========================================================================= // 상수 정의 // ========================================================================= public const TYPE_FISCAL = 'fiscal'; public const TYPE_HIRE = 'hire'; public const STANDARD_TYPES = [ self::TYPE_FISCAL, self::TYPE_HIRE, ]; // ========================================================================= // 관계 정의 // ========================================================================= /** * 테넌트 */ public function tenant(): BelongsTo { return $this->belongsTo(Tenant::class); } // ========================================================================= // 헬퍼 메서드 // ========================================================================= /** * 기준 유형 라벨 */ public function getStandardTypeLabelAttribute(): string { return match ($this->standard_type) { self::TYPE_FISCAL => '회계연도', self::TYPE_HIRE => '입사일', default => $this->standard_type, }; } /** * 기준일 문자열 */ public function getFiscalStartDateStringAttribute(): string { return "{$this->fiscal_start_month}월 {$this->fiscal_start_day}일"; } /** * 기본 설정 생성 */ public static function createDefault(int $tenantId, ?int $userId = null): self { return self::create([ 'tenant_id' => $tenantId, 'standard_type' => self::TYPE_FISCAL, 'fiscal_start_month' => 1, 'fiscal_start_day' => 1, 'default_annual_leave' => 15, 'additional_leave_per_year' => 1, 'max_annual_leave' => 25, 'carry_over_enabled' => true, 'carry_over_max_days' => 10, 'carry_over_expiry_months' => 3, 'created_by' => $userId, 'updated_by' => $userId, ]); } }