diff --git a/routes/web.php b/routes/web.php index 989dc78b..6de87a19 100644 --- a/routes/web.php +++ b/routes/web.php @@ -33,9 +33,16 @@ Route::get('/po-approval', function(){ $bookings = Booking::where('admin_status', 6)->where(function($q){ $q->WhereDoesntHave('invoice')->WhereDoesntHave('purchaseOrder'); })->get(); + $months = $bookings->groupBy(function($item) { + return $item->created_at->format('Y-m'); + }); echo "

Total Po Pending Customer Update: ".count($bookings)."

"; - foreach ($bookings as $booking){ - echo "".$booking->id."
"; + foreach ($months as $month => $bookings) { + echo "

".$month."(".count($bookings).")


"; + foreach ($bookings as $booking) { + echo "".$booking->id." date: ".$booking->created_at."
"; + } + echo "


"; } })->name('po.approval');