From bb05a68eb5767aaa2b2751ad53674027ea5a6793 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Tue, 29 Sep 2020 13:13:22 +0800 Subject: [PATCH] list po pending approval --- routes/web.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/routes/web.php b/routes/web.php index 0ea962b6..69137668 100644 --- a/routes/web.php +++ b/routes/web.php @@ -18,12 +18,14 @@ Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm Route::post('password/reset', 'Auth\ResetPasswordController@postReset')->name('password.reset'); Route::get('/po-approval', function(){ - $approvedInvoices = InvoiceStatuses::where('status', 'approve')->distinct()->get(['invoice_id'])->pluck('invoice_id'); + $approvedInvoices = InvoiceStatuses::where(function($q) { + $q->where('status', 'approve') + ->orWhere('status', 'request_change'); + })->distinct()->get(['invoice_id'])->pluck('invoice_id'); $invoices = InvoiceStatuses::whereNotIn('invoice_id', $approvedInvoices)->get(); - dd($invoices); echo "

Total PO Pending Approval:".count($invoices)."

"; foreach ($invoices as $invoice){ - echo "".$invoice->booking->id."
"; + echo "".$invoice->invoice->booking->id."
"; } })->name('po.approval');