diff --git a/routes/web.php b/routes/web.php index b7956131..ada48c39 100644 --- a/routes/web.php +++ b/routes/web.php @@ -430,16 +430,17 @@ Route::get('/po/manual/fix', function(){ Route::get('/payment/check', function(){ - $transactions = Transaction::where('type', TransactionType::BILL)->whereDate('created_at', '>=', Carbon::today())->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->get(); + $transactions = Transaction::where('type', TransactionType::INVOICE)->whereDate('created_at', '>=', Carbon::today())->get(); foreach ($transactions as $transaction){ - $documents = $transaction->documents; + $booking = $transactions->owner; + $documents = $booking->documents()->where('document_type', DocumentType::INVOICE); if(!count($documents)){ - echo $transaction->owner->owner->marking.'

'; + echo $booking->marking.'

'; continue; } - echo $transaction->owner->owner->marking.'. payment: '.$transaction->updated_at.' -> document: '.$documents[0]->created_at.'
'; +// echo $transaction->owner->owner->marking.'. payment: '.$transaction->updated_at.' -> document: '.$documents[0]->created_at.'
'; }