diff --git a/app/Models/Tenants/TodayIssue.php b/app/Models/Tenants/TodayIssue.php index 4aa2165..9b9dc00 100644 --- a/app/Models/Tenants/TodayIssue.php +++ b/app/Models/Tenants/TodayIssue.php @@ -128,6 +128,14 @@ public function scopeActive($query) }); } + /** + * 오늘 날짜 이슈 스코프 + */ + public function scopeToday($query) + { + return $query->whereDate('created_at', today()); + } + /** * 뱃지별 필터 스코프 */ diff --git a/app/Services/TodayIssueService.php b/app/Services/TodayIssueService.php index 92bf15e..d703bc1 100644 --- a/app/Services/TodayIssueService.php +++ b/app/Services/TodayIssueService.php @@ -25,6 +25,7 @@ public function summary(int $limit = 30, ?string $badge = null): array $query = TodayIssue::query() ->where('tenant_id', $tenantId) ->active() // 만료되지 않은 이슈만 + ->today() // 오늘 날짜 이슈만 ->orderByDesc('created_at'); // 뱃지 필터 @@ -32,10 +33,11 @@ public function summary(int $limit = 30, ?string $badge = null): array $query->byBadge($badge); } - // 전체 개수 (필터 적용 전) + // 전체 개수 (필터 적용 전, 오늘 날짜만) $totalQuery = TodayIssue::query() ->where('tenant_id', $tenantId) - ->active(); + ->active() + ->today(); $totalCount = $totalQuery->count(); // 결과 조회