From 5cc2ae1c581af6b454c3fcb6dbd9827982ca6469 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Thu, 8 Sep 2022 20:37:42 +0800 Subject: [PATCH] generate invoices for 1688 orders --- routes/web.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/routes/web.php b/routes/web.php index 5f9e323e..eb0927c1 100644 --- a/routes/web.php +++ b/routes/web.php @@ -380,10 +380,11 @@ Route::get('/payments/manual', function(){ }); Route::get('/1688/fix', function(){ - $purchaseOrderDocuments = \App\Models\Document::where('document_type', DocumentType::ECOMMERCE_PURCHASE_ORDER)->get(); + $purchaseOrderDocuments = \App\Models\Document::where('document_type', DocumentType::ECOMMERCE_PURCHASE_ORDER)->doesntHave('owner', function($query){ + return $query->where('owner.status', ApprovalStatus::COMPLETED); + })->get(); foreach($purchaseOrderDocuments as $document){ - if($document->owner->status === ApprovalStatus::COMPLETED) continue; (App()->make(createPurchaseOrderFor1688OrderProcessor::class))->execute($document->owner); } });