fix(search): match Arabic ye/kaf with Persian letters in admin search

Customer names stored with ي/ك were missed when typing ی/ک; fold both sides of LIKE.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-01 21:38:09 +03:30
co-authored by Cursor
parent e27a8ac397
commit cae41e72b8
5 changed files with 57 additions and 17 deletions
@@ -10,6 +10,7 @@ use App\Models\AppNotificationRecipient;
use App\Models\Customer;
use App\Services\AppNotificationAudienceService;
use App\Services\PriceStreamService;
use App\Support\PersianText;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
@@ -67,7 +68,10 @@ class AppNotificationController extends Controller
->where('is_archive', false)
->when($q !== '', function ($query) use ($q) {
$query->where(function ($inner) use ($q) {
$inner->where('name', 'like', '%' . $q . '%')
$inner->whereRaw(
PersianText::sqlFoldExpr('lower(`name`)').' like ?',
[PersianText::likePattern(strtolower($q))]
)
->orWhere('mobile', 'like', '%' . $q . '%')
->orWhere('id', $q);
});
@@ -9,6 +9,7 @@ use App\Models\CustomerSpecialPricePackage;
use App\Models\Product;
use App\Services\ConfigService;
use App\Services\CustomerSpecialPricingService;
use App\Support\PersianText;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
@@ -163,7 +164,10 @@ class CustomerSpecialPricePackageController extends Controller
})
->when($q !== '', function ($query) use ($q) {
$query->where(function ($inner) use ($q) {
$inner->where('name', 'like', '%' . $q . '%')
$inner->whereRaw(
PersianText::sqlFoldExpr('lower(`name`)').' like ?',
[PersianText::likePattern(strtolower($q))]
)
->orWhere('mobile', 'like', '%' . $q . '%')
->orWhere('id', $q);
});