show active customers in the report

This commit is contained in:
omair saleh
2021-01-09 11:11:26 +08:00
parent 71ae8eccc9
commit c6da00e1d5
+3 -1
View File
@@ -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 "<h1>".Carbon::parse($month)->format('m-Y').": <small style='color: green; font-size: larger'>".$bookings->sum('bia')." MYR</small></h1>";
echo "<h3>New Customer: <small style='color: green; font-size: larger'>".count($newCustomers)." Customers</small></h3>";
echo "<h3>Active Customers: <small style='color: green; font-size: larger'>".count($bookings->groupBy(function($item){
return $item->user_id;
}))."</small></h3>";
}))." Customers</small></h3>";
$days = $bookings->groupBy(function($item){
return $item->created_at->format('Y-m-d');
});