Deploy: 2026-05-23 03:23:22
This commit is contained in:
@@ -86,6 +86,25 @@ class WhatsAppSession extends BaseModel
|
||||
return $session;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find session by phone number (useful to prevent duplicates across companies)
|
||||
*/
|
||||
public static function findByPhone(string $phone)
|
||||
{
|
||||
$phoneHash = Security::blindIndex($phone);
|
||||
$session = Database::selectOne(
|
||||
"SELECT * FROM " . static::$table . " WHERE phone_hash = ? LIMIT 1",
|
||||
[$phoneHash]
|
||||
);
|
||||
|
||||
if ($session) {
|
||||
$session['phone'] = $session['phone'] ? Security::decrypt($session['phone']) : null;
|
||||
$session['qr_code'] = $session['qr_code'] ? Security::decrypt($session['qr_code']) : null;
|
||||
}
|
||||
|
||||
return $session;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create or retrieve a new session for a company
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user