From 574a95fd145ac7f3620e586f77d30e43bb693ff7 Mon Sep 17 00:00:00 2001 From: drkthunder02 Date: Wed, 3 Jul 2019 18:38:20 -0500 Subject: [PATCH] srp admin controller --- app/Http/Controllers/SRP/SRPAdminController.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/SRP/SRPAdminController.php b/app/Http/Controllers/SRP/SRPAdminController.php index b11085a9f..fc8f41696 100644 --- a/app/Http/Controllers/SRP/SRPAdminController.php +++ b/app/Http/Controllers/SRP/SRPAdminController.php @@ -111,19 +111,21 @@ class SRPAdminController extends Controller public function displayStatistics() { $months = 3; $barChartData = array(); + $now = Carbon::now(); + $previous = Carbon::now()->subMonths(3); //We need a function from this library rather than recreating a new library $srpHelper = new SRPHelper(); //Get the number of approved, denied, and under review payouts currently from the database $pieOpen = SRPShip::where(['approved' => 'Under Review']) - ->whereBetween('created_at', [Carbon::now(), Carbon::now()->subMonths(3)]) + ->whereBetween('created_at', [$now, $previous]) ->count(); $pieApproved = SRPShip::where(['approved' => 'Approved']) - ->whereBetween('created_at', [Carbon::now(), Carbon::now()->subMonths(3)]) + ->whereBetween('created_at', [$now, $previous]) ->count(); $pieDenied = SRPShip::where(['approved' => 'Denied']) - ->whereBetween('created_at', [Carbon::now(), Carbon::now()->subMonths(3)]) + ->whereBetween('created_at', [$now, $previous]) ->count(); //Get the amount of open orders