show old invoices

This commit is contained in:
omair saleh
2020-09-25 18:13:51 +08:00
parent d018bee90e
commit ad2203e18a
+3 -2
View File
@@ -18,11 +18,12 @@ Route::post('password/reset', 'Auth\ResetPasswordController@postReset')->name('p
Route::get('/old-invoices', function(){
$bookings = \App\Booking::where('status', 6)->whereHas('purchaseOrder', function($q){
$q->whereNotNull('image_path');
})->get()->groupBy(function($item) {
})->get();
$months = $bookings->groupBy(function($item) {
return $item->created_at->format('Y-m');
});
echo "<h1>Total pending invoices:<b>".count($bookings)."</b></h1>";
foreach ($bookings as $month => $bookings) {
foreach ($months as $month => $bookings) {
echo "<h3>".$month."</h3><br>";
foreach ($bookings as $booking) {
echo "<a target='_blank' href='https://exchange.cief-malaysia.com/booking/".$booking->id."/upload-invoice'>".$booking->id."</a> <small>date: ".$booking->created_at."</small><br>";