mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 15:14:35 -04:00
Fixes for multidb + twilio
This commit is contained in:
parent
438562ab8f
commit
d78415b6bf
@ -419,6 +419,34 @@ class MultiDB
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $data
|
||||||
|
* @return User|null
|
||||||
|
*/
|
||||||
|
public static function hasPhoneNumber(string $phone) : ?User
|
||||||
|
{
|
||||||
|
if (! config('ninja.db.multi_db_enabled'))
|
||||||
|
return Account::where('account_sms_verification_number', $phone)->where('account_sms_verified', true)->exists();
|
||||||
|
|
||||||
|
$current_db = config('database.default');
|
||||||
|
|
||||||
|
foreach (self::$dbs as $db) {
|
||||||
|
|
||||||
|
self::setDB($db);
|
||||||
|
if ($exists = Account::where('account_sms_verification_number', $phone)->where('account_sms_verified', true)->exists()) {
|
||||||
|
self::setDb($current_db);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
self::setDb($current_db);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static function randomSubdomainGenerator()
|
public static function randomSubdomainGenerator()
|
||||||
{
|
{
|
||||||
$current_db = config('database.default');
|
$current_db = config('database.default');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user