'array', 'standard_hours' => 'integer', 'overtime_hours' => 'integer', 'overtime_limit' => 'integer', 'break_minutes' => 'integer', ]; protected $attributes = [ 'work_type' => 'fixed', 'standard_hours' => 40, 'overtime_hours' => 12, 'overtime_limit' => 52, 'start_time' => '09:00:00', 'end_time' => '18:00:00', 'break_minutes' => 60, 'break_start' => '12:00:00', 'break_end' => '13:00:00', ]; // ========================================================================= // 상수 정의 // ========================================================================= public const TYPE_FIXED = 'fixed'; // 고정 근무 public const TYPE_FLEXIBLE = 'flexible'; // 유연 근무 public const TYPE_CUSTOM = 'custom'; // 커스텀 근무 public const WORK_TYPES = [ self::TYPE_FIXED, self::TYPE_FLEXIBLE, self::TYPE_CUSTOM, ]; public const DEFAULT_WORK_DAYS = ['mon', 'tue', 'wed', 'thu', 'fri']; // ========================================================================= // 헬퍼 메서드 // ========================================================================= /** * 근무 유형 라벨 */ public function getWorkTypeLabelAttribute(): string { return match ($this->work_type) { self::TYPE_FIXED => '고정근무', self::TYPE_FLEXIBLE => '유연근무', self::TYPE_CUSTOM => '커스텀', default => $this->work_type, }; } /** * 일일 근무시간 계산 (분) */ public function getDailyWorkMinutesAttribute(): int { $start = strtotime($this->start_time); $end = strtotime($this->end_time); $totalMinutes = ($end - $start) / 60; return (int) ($totalMinutes - $this->break_minutes); } }