From c4dbeaaf226a4a34cc60642348119267413d5fa7 Mon Sep 17 00:00:00 2001 From: Jing Li Date: Wed, 24 Apr 2024 13:13:05 +0800 Subject: [PATCH] Update --- app/Services/StatisticService.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Services/StatisticService.php b/app/Services/StatisticService.php index d58095f..9a149fb 100644 --- a/app/Services/StatisticService.php +++ b/app/Services/StatisticService.php @@ -118,6 +118,10 @@ class StatisticService */ public function sales(Carbon $start, Carbon $end, array $input = []): array { + $input = array_merge($input, [ + 'date_range' => $start->toDateString().','.$end->toDateString(), + ]); + /** @var \Illuminate\Database\Eloquent\Collection */ $lotteryTypes = Keyword::where('parent_key', 'lottery_type')->get(); @@ -129,7 +133,6 @@ class StatisticService DB::raw('SUM(expenditure) as expenditure') ]) ->filter($input, LedgerFilter::class) - ->whereBetween('date', [$start->format('Y-m-d'), $end->format('Y-m-d')]) ->groupBy(['date']) ->get() ->keyBy('date'); @@ -143,7 +146,6 @@ class StatisticService ]) ->filter($input, LedgerItemFilter::class) ->whereIn('ledger_item_type_id', $lotteryTypes->pluck('key')) - ->whereBetween('date', [$start->format('Y-m-d'), $end->format('Y-m-d')]) ->groupBy(['date', 'ledger_item_type_id']) ->get() ->groupBy('date');