mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Ensure hosted platform always has a subdomain configured
This commit is contained in:
parent
2d953dff10
commit
78aebe6bf7
@ -15,6 +15,7 @@ use App;
|
||||
use App\Factory\ClientContactFactory;
|
||||
use App\Factory\VendorContactFactory;
|
||||
use App\Jobs\Company\CreateCompanyToken;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Account;
|
||||
use App\Models\BankTransaction;
|
||||
use App\Models\Client;
|
||||
@ -128,6 +129,7 @@ class CheckData extends Command
|
||||
$this->checkUserState();
|
||||
$this->checkContactEmailAndSendEmailStatus();
|
||||
$this->checkPaymentCurrency();
|
||||
$this->checkSubdomainsSet();
|
||||
|
||||
if (Ninja::isHosted()) {
|
||||
$this->checkAccountStatuses();
|
||||
@ -1019,6 +1021,23 @@ class CheckData extends Command
|
||||
}
|
||||
}
|
||||
|
||||
public function checkSubdomainsSet()
|
||||
{
|
||||
if(Ninja::isSelfHost())
|
||||
return;
|
||||
|
||||
Company::query()
|
||||
->whereNull('subdomain')
|
||||
->orWhere('subdomain', '')
|
||||
->cursor()
|
||||
->each(function ($c){
|
||||
|
||||
$c->subdomain = MultiDB::randomSubdomainGenerator();
|
||||
$c->save();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public function checkPaymentCurrency()
|
||||
{
|
||||
$p = Payment::with('company','client')
|
||||
|
Loading…
x
Reference in New Issue
Block a user