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