Fix search country limit
This commit is contained in:
@@ -36,11 +36,15 @@ class IkeaProducts extends Model
|
|||||||
} else if ($field == "all") {
|
} else if ($field == "all") {
|
||||||
if (preg_match("/0[0-9]+/", $text)) {
|
if (preg_match("/0[0-9]+/", $text)) {
|
||||||
$result = $this->where("code", '=',$text);
|
$result = $this->where("code", '=',$text);
|
||||||
|
$result->where('country', $country);
|
||||||
} else {
|
} else {
|
||||||
|
if (strlen($text) < 2) return [];
|
||||||
$result = $this;
|
$result = $this;
|
||||||
|
|
||||||
if (strlen($text) >= 2) $result = $result->where("name", 'LIKE', '%'. $text . '%');
|
if (strlen($text) >= 2) $result = $result->where("name", 'LIKE', '%'. $text . '%');
|
||||||
if (strlen($text) > 3) $result->orWhere("typeName", 'LIKE', '%'. $text . '%');
|
if (strlen($text) > 3) $result->orWhere("typeName", 'LIKE', '%'. $text . '%');
|
||||||
|
|
||||||
|
$result->where('country', $country);
|
||||||
}
|
}
|
||||||
return $result->get();
|
return $result->get();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user