From cc8ee2e520670f577b5fac2e6be720f8a24c12ac Mon Sep 17 00:00:00 2001 From: shibafu Date: Sat, 30 Mar 2019 13:29:55 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=B0=E3=83=A9=E3=83=95=E7=94=BB=E9=9D=A2?= =?UTF-8?q?=E3=81=A7=E8=A1=A8=E7=A4=BA=E3=81=99=E3=82=8B=E3=83=87=E3=83=BC?= =?UTF-8?q?=E3=82=BF=E7=AF=84=E5=9B=B2=E3=82=92=E5=BD=93=E6=9C=88=E6=9C=AB?= =?UTF-8?q?=E3=81=BE=E3=81=A7=E3=81=AB=E5=88=B6=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/UserController.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index db289a8..1640c78 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -67,6 +67,8 @@ SQL abort(404); } + $dateUntil = now()->addMonth()->startOfMonth(); + $groupByDay = Ejaculation::select(DB::raw( <<<'SQL' to_char(ejaculated_date, 'YYYY/MM/DD') AS "date", @@ -74,6 +76,7 @@ count(*) AS "count" SQL )) ->where('user_id', $user->id) + ->where('ejaculated_date', '<', $dateUntil) ->groupBy(DB::raw("to_char(ejaculated_date, 'YYYY/MM/DD')")) ->orderBy(DB::raw("to_char(ejaculated_date, 'YYYY/MM/DD')")) ->get(); @@ -85,6 +88,7 @@ count(*) AS "count" SQL )) ->where('user_id', $user->id) + ->where('ejaculated_date', '<', $dateUntil) ->groupBy(DB::raw("to_char(ejaculated_date, 'HH24')")) ->orderBy(DB::raw('1')) ->get();