From 65720e5433c1b7aaec65ef7d1d095b844e9c48c1 Mon Sep 17 00:00:00 2001 From: Jaroslav Drzik Date: Thu, 21 Mar 2024 21:01:09 +0100 Subject: [PATCH] Fix search country limit --- app/Models/IkeaProducts.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/Models/IkeaProducts.php b/app/Models/IkeaProducts.php index 6d1cec9..7a657d3 100644 --- a/app/Models/IkeaProducts.php +++ b/app/Models/IkeaProducts.php @@ -36,11 +36,15 @@ class IkeaProducts extends Model } else if ($field == "all") { if (preg_match("/0[0-9]+/", $text)) { $result = $this->where("code", '=',$text); + $result->where('country', $country); } else { + if (strlen($text) < 2) return []; $result = $this; if (strlen($text) >= 2) $result = $result->where("name", 'LIKE', '%'. $text . '%'); if (strlen($text) > 3) $result->orWhere("typeName", 'LIKE', '%'. $text . '%'); + + $result->where('country', $country); } return $result->get(); }