toDateString(); $onVacationToday = Vacation::query() ->where('status', ApprovalStatus::Approved) ->whereDate('start_date', '<=', $today) ->whereDate('end_date', '>=', $today) ->count(); $onSickLeaveToday = SickLeave::query() ->whereDate('start_date', '<=', $today) ->whereDate('end_date', '>=', $today) ->count(); $pendingRequests = Vacation::query() ->where('status', ApprovalStatus::Pending) ->count(); return [ Stat::make(__('hr.stats.total_employees'), Employee::query()->count()) ->description(__('hr.stats.total_employees_desc')) ->descriptionIcon('heroicon-o-users') ->color('primary'), Stat::make(__('hr.stats.active'), Employee::query()->where('employment_status', EmploymentStatus::Active)->count()) ->description(__('hr.stats.active_desc')) ->descriptionIcon('heroicon-o-check-circle') ->color('success'), Stat::make(__('hr.stats.inactive'), Employee::query()->where('employment_status', EmploymentStatus::Inactive)->count()) ->description(__('hr.stats.inactive_desc')) ->descriptionIcon('heroicon-o-pause-circle') ->color('gray'), Stat::make(__('hr.stats.on_vacation_today'), $onVacationToday) ->description(__('hr.stats.on_vacation_today_desc')) ->descriptionIcon('heroicon-o-sun') ->color('warning'), Stat::make(__('hr.stats.on_sick_leave_today'), $onSickLeaveToday) ->description(__('hr.stats.on_sick_leave_today_desc')) ->descriptionIcon('heroicon-o-heart') ->color('danger'), Stat::make(__('hr.stats.pending_requests'), $pendingRequests) ->description(__('hr.stats.pending_requests_desc')) ->descriptionIcon('heroicon-o-clock') ->color('info'), ]; } }