Files
sam-manage/app/Console/Commands/MarkAbsentEmployees.php

31 lines
882 B
PHP
Raw Normal View History

<?php
namespace App\Console\Commands;
use App\Services\HR\AttendanceService;
use Illuminate\Console\Command;
class MarkAbsentEmployees extends Command
{
protected $signature = 'attendance:mark-absent {--date= : 대상 날짜 (YYYY-MM-DD), 기본값: 오늘}';
protected $description = '영업일에 출근 기록이 없는 사원을 자동 결근 처리';
public function handle(AttendanceService $service): int
{
$date = $this->option('date') ?: now()->toDateString();
$this->info("자동 결근 처리 시작: {$date}");
$count = $service->markAbsentees($date);
if ($count > 0) {
$this->info("{$count}명 결근 처리 완료");
} else {
$this->info('결근 처리 대상이 없습니다 (주말이거나 모든 사원에 기록이 있음)');
}
return self::SUCCESS;
}
}