From e1547f986a2aedf14d7e535e5c5dc7f24604a36d Mon Sep 17 00:00:00 2001 From: omair saleh Date: Mon, 8 Feb 2021 19:11:55 +0800 Subject: [PATCH] show total in x1 report --- routes/web.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routes/web.php b/routes/web.php index 4e47be69..49391090 100644 --- a/routes/web.php +++ b/routes/web.php @@ -24,10 +24,10 @@ 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(); + echo "Total: ".$bookings->sum('bia'); $months = $bookings->groupBy(function($item) { return $item->created_at->format('Y-m'); }); - foreach($months as $month => $bookings){ $newCustomers = \App\User::whereYear('created_at', '=', Carbon::parse($month)->format('Y')) ->whereMonth('created_at', '=', Carbon::parse($month)->format('m'))->get(); echo "

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

";