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); } });