From b1d6f602ce61429d7bd6f3ef588c7ec7440f14dc Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 8 Mar 2022 22:19:25 +1100 Subject: [PATCH] Checks for company user in check data --- app/Console/Commands/CheckData.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/app/Console/Commands/CheckData.php b/app/Console/Commands/CheckData.php index b76ddc26670b..710bd09f1275 100644 --- a/app/Console/Commands/CheckData.php +++ b/app/Console/Commands/CheckData.php @@ -1010,6 +1010,27 @@ ORDER BY clients.id; } +/* //used to set a company owner on the company_users table + +$c = Company::whereDoesntHave('company_users', function ($query){ + $query->where('is_owner', true)->withTrashed(); +})->cursor()->each(function ($company){ + + if(!$company->company_users()->exists()){ + echo "No company users AT ALL {$company->id}\n"; + + } + else{ + + $cu = $company->company_users()->orderBy('id', 'ASC')->orderBy('is_admin', 'ASC')->first(); + echo "{$company->id} - {$cu->id} \n"; + $cu->is_owner=true; + $cu->save(); + + } +}); +*/ + /* query if we want to company company ledger to client balance $results = \DB::select( \DB::raw(" SELECT