mirror of
https://github.com/freescout-helpdesk/freescout.git
synced 2024-11-24 19:33:07 +01:00
When creating a phone conversations try to find customer by phone number
This commit is contained in:
parent
e5bd0dfe49
commit
61bb42ae3a
@ -675,6 +675,15 @@ class Customer extends Model
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find customer by phone number.
|
||||||
|
*/
|
||||||
|
public static function findByPhone($phone)
|
||||||
|
{
|
||||||
|
$phone = trim($phone);
|
||||||
|
return Customer::where('phones', 'LIKE', '%"'.$phone.'"%')->first();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get customers social profiles as array.
|
* Get customers social profiles as array.
|
||||||
*
|
*
|
||||||
|
@ -2500,6 +2500,14 @@ class ConversationsController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Try to find customer by phone.
|
||||||
|
if (!$customer && $request->phone) {
|
||||||
|
$customer = Customer::findByPhone($request->phone);
|
||||||
|
if ($customer) {
|
||||||
|
$customer_email = $customer->getMainEmail();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!$customer) {
|
if (!$customer) {
|
||||||
// Create customer with passed name, email and phone
|
// Create customer with passed name, email and phone
|
||||||
if (Email::sanitizeEmail($request->to_email)) {
|
if (Email::sanitizeEmail($request->to_email)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user