Files
sam-manage/app/Models/HR/LeaveBalance.php
김보곤 adc587292f feat: [attendance] 근태관리 2차 고도화 8개 기능 구현
- 월간 캘린더 뷰 (사원별 필터, 날짜 클릭 등록, HTMX 월 이동)
- 일괄 등록 (다수 사원 체크박스 선택 후 일괄 등록, upsert 처리)
- 사원별 월간 요약 (상태별 카운트 + 총 근무시간 집계 테이블)
- 초과근무 알림 (주 48h 경고 / 52h 위험 배너)
- 근태 승인 워크플로우 (신청→승인→근태 레코드 자동 생성)
- 자동 결근 처리 (매일 23:50 스케줄러, 주말 제외)
- 연차 관리 연동 (휴가 등록 시 leave_balances 자동 차감)
- GPS 출퇴근 UI (테이블 GPS 아이콘 + 상세 모달)
- 탭 네비게이션 (목록/캘린더/요약/승인) HTMX 기반 전환
2026-02-26 21:29:25 +09:00

39 lines
823 B
PHP

<?php
namespace App\Models\HR;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class LeaveBalance extends Model
{
protected $table = 'leave_balances';
protected $fillable = [
'tenant_id',
'user_id',
'year',
'total_days',
'used_days',
];
protected $casts = [
'tenant_id' => 'int',
'user_id' => 'int',
'year' => 'int',
'total_days' => 'float',
'used_days' => 'float',
'remaining_days' => 'float',
];
public function user(): BelongsTo
{
return $this->belongsTo(\App\Models\User::class, 'user_id');
}
public function getRemainingAttribute(): float
{
return $this->remaining_days ?? ($this->total_days - $this->used_days);
}
}