show active customers in the report

This commit is contained in:
omair saleh
2021-01-09 10:56:22 +08:00
parent 71b3e23e9f
commit 16aa8f5f99
+3 -1
View File
@@ -23,7 +23,6 @@ Route::post('password/reset', 'Auth\ResetPasswordController@postReset')->name('p
Route::group(['middleware' => ['role:admin']], function() {
Route::get('/report/x1', function(){
$bookings = Booking::where('admin_status', '>=', 3)->where('term', 'like', 'x1_%')->where('is_cancel', false)->where('user_id', '!=', 1)->get();
$months = $bookings->groupBy(function($item) {
return $item->created_at->format('Y-m');
@@ -31,6 +30,9 @@ Route::group(['middleware' => ['role:admin']], function() {
foreach($months as $month => $bookings){
echo "<h1>".Carbon::parse($month)->format('m-Y').": <small style='color: green; font-size: larger'>".$bookings->sum('bia')." MYR</small></h1>";
echo "<h3>Active Customers: <small style='color: green; font-size: larger'>".count($bookings->groupBy(function($item){
return $item->user_id;
}))." MYR</small></h3>";
$days = $bookings->groupBy(function($item){
return $item->created_at->format('Y-m-d');
});