Tweaks for company size check

This commit is contained in:
David Bomba 2021-06-24 13:22:46 +10:00
parent f696f4926a
commit 6e212d7d55

View File

@ -55,10 +55,15 @@ class CompanySizeCheck implements ShouldQueue
private function check() private function check()
{ {
Company::cursor()->each(function ($company) { Company::cursor()->each(function ($company) {
if ($company->invoices->count() > 1000 || $company->products->count() > 1000 || $company->clients->count() > 1000) {
if ($company->invoices()->count() > 1000 || $company->products()->count() > 1000 || $company->clients()->count() > 1000) {
nlog("Marking company {$company->id} as large");
$company->is_large = true; $company->is_large = true;
$company->save(); $company->save();
} }
}); });
} }
} }