From 2da5ac6caa8f58cf730baf63e1b12454dfe732aa Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 22 Jun 2021 17:24:14 +1000 Subject: [PATCH] Subdomain filling --- app/Console/Commands/SubdomainFill.php | 64 ++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 app/Console/Commands/SubdomainFill.php diff --git a/app/Console/Commands/SubdomainFill.php b/app/Console/Commands/SubdomainFill.php new file mode 100644 index 000000000000..ad5471d7866c --- /dev/null +++ b/app/Console/Commands/SubdomainFill.php @@ -0,0 +1,64 @@ +whereNull('subdomain')->orWhere('subdomain', '')->get(); + $c2 = Company::on('db-ninja-02')->whereNull('subdomain')->orWhere('subdomain', '')->get(); + + + $c1->each(function ($company){ + + $company->subdomain = MultiDB::randomSubdomainGenerator(); + $company->save(); + + }); + + $c2->each(function ($company){ + + $company->subdomain = MultiDB::randomSubdomainGenerator(); + $company->save(); + + }); + + } + +}