добавил возможность поиска клиента по номеру в произвольном формате

This commit is contained in:
developer 2026-05-07 11:17:40 +08:00
parent 9f1225c73e
commit 8a76c75c6a

View File

@ -119,9 +119,12 @@ function getClients()
if (array_key_exists('search', $this->filter) && $searchString = trim($this->filter['search'])) { if (array_key_exists('search', $this->filter) && $searchString = trim($this->filter['search'])) {
$searchString = mb_strtolower(trim($this->filter['search'])); $searchString = mb_strtolower(trim($this->filter['search']));
// $clients->whereFullText(['name', 'phone', 'email', 'normalized_name', 'normalized_phone'], $searchString); // $clients->whereFullText(['name', 'phone', 'email', 'normalized_name', 'normalized_phone'], $searchString);
$clients->where('normalized_name', 'like', "%{$searchString}%") $clients->where(function ($query) use ($searchString) {
$query->where('normalized_name', 'like', "%{$searchString}%")
->orWhere('normalized_phone', 'like', "%{$this->normilizePhone($searchString)}%") ->orWhere('normalized_phone', 'like', "%{$this->normilizePhone($searchString)}%")
->orWhere('email', 'like', "%{$searchString}%"); ->orWhere('email', 'like', "%{$searchString}%");
});
} }
if (array_key_exists('status', $this->filter) && $this->status == DealStatus::UNIQUE) { if (array_key_exists('status', $this->filter) && $this->status == DealStatus::UNIQUE) {