$date], ['post_count' => $postCount, 'comment_count' => $commentCount], ); } /** * 날짜 범위(포함)의 집계 행을 날짜 오름차순으로 조회합니다. * * @param string $startDate 시작 날짜 (Y-m-d, 포함) * @param string $endDate 종료 날짜 (Y-m-d, 포함) * @return Collection 날짜 오름차순 집계 행 컬렉션 */ public function getByDateRange(string $startDate, string $endDate): Collection { return BoardStat::query() ->whereBetween('date', [$startDate, $endDate]) ->orderBy('date') ->get(); } /** * 특정 날짜의 집계 행을 조회합니다. * * @param string $date 집계 기준 날짜 (Y-m-d) * @return BoardStat|null 집계 행 또는 null */ public function findByDate(string $date): ?BoardStat { return BoardStat::query()->where('date', $date)->first(); } }