srp admin controller

This commit is contained in:
2019-07-03 18:38:20 -05:00
parent 10a00750d7
commit 574a95fd14

View File

@@ -111,19 +111,21 @@ class SRPAdminController extends Controller
public function displayStatistics() { public function displayStatistics() {
$months = 3; $months = 3;
$barChartData = array(); $barChartData = array();
$now = Carbon::now();
$previous = Carbon::now()->subMonths(3);
//We need a function from this library rather than recreating a new library //We need a function from this library rather than recreating a new library
$srpHelper = new SRPHelper(); $srpHelper = new SRPHelper();
//Get the number of approved, denied, and under review payouts currently from the database //Get the number of approved, denied, and under review payouts currently from the database
$pieOpen = SRPShip::where(['approved' => 'Under Review']) $pieOpen = SRPShip::where(['approved' => 'Under Review'])
->whereBetween('created_at', [Carbon::now(), Carbon::now()->subMonths(3)]) ->whereBetween('created_at', [$now, $previous])
->count(); ->count();
$pieApproved = SRPShip::where(['approved' => 'Approved']) $pieApproved = SRPShip::where(['approved' => 'Approved'])
->whereBetween('created_at', [Carbon::now(), Carbon::now()->subMonths(3)]) ->whereBetween('created_at', [$now, $previous])
->count(); ->count();
$pieDenied = SRPShip::where(['approved' => 'Denied']) $pieDenied = SRPShip::where(['approved' => 'Denied'])
->whereBetween('created_at', [Carbon::now(), Carbon::now()->subMonths(3)]) ->whereBetween('created_at', [$now, $previous])
->count(); ->count();
//Get the amount of open orders //Get the amount of open orders