diff --git a/routes/web.php b/routes/web.php index 31e37558..0cc4fce5 100644 --- a/routes/web.php +++ b/routes/web.php @@ -29,10 +29,12 @@ Route::group(['middleware' => ['role:admin']], function() { }); foreach($months as $month => $bookings){ + $newCustomers = \App\User::whereYear('created_at', '=', Carbon::parse($month)->format('Y')) ->whereMonth('created_at', '=', Carbon::parse($month)->format('Y'))->get(); echo "

".Carbon::parse($month)->format('m-Y').": ".$bookings->sum('bia')." MYR

"; + echo "

New Customer: ".count($newCustomers)." Customers

"; echo "

Active Customers: ".count($bookings->groupBy(function($item){ return $item->user_id; - }))."

"; + }))." Customers"; $days = $bookings->groupBy(function($item){ return $item->created_at->format('Y-m-d'); });