Search with 3 characters in products name and 5 charcters in descriptiom
Some checks are pending
deploy / deploy (push) Waiting to run
Some checks are pending
deploy / deploy (push) Waiting to run
This commit is contained in:
@@ -26,7 +26,9 @@ class IkeaProducts extends Model
|
|||||||
|
|
||||||
protected function search($item)
|
protected function search($item)
|
||||||
{
|
{
|
||||||
if (strlen($item) > 3) {
|
if (strlen($item) >= 3 && strlen($item) <= 5) {
|
||||||
|
return $this->where('name', 'LIKE', '%' . $item . '%')->get();
|
||||||
|
} else if (strlen($item >= 5)) {
|
||||||
return $this->where('typeName', 'LIKE', '%' . $item . '%')->orWhere('name', 'LIKE', '%' . $item . '%')->get();
|
return $this->where('typeName', 'LIKE', '%' . $item . '%')->orWhere('name', 'LIKE', '%' . $item . '%')->get();
|
||||||
} else {
|
} else {
|
||||||
return [];
|
return [];
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ const fetch_rates = async () => {
|
|||||||
|
|
||||||
const async_search = async (item) => {
|
const async_search = async (item) => {
|
||||||
try {
|
try {
|
||||||
if (item.length > 4) {
|
if (item.length >= 3) {
|
||||||
const response = await axios.get(route('products.search', item));
|
const response = await axios.get(route('products.search', item));
|
||||||
options_items.value = response.data.map((i) => { return { "item": i.name, "desc": i.typeName, "img": i.mainImageUrl, "code": i.code } });
|
options_items.value = response.data.map((i) => { return { "item": i.name, "desc": i.typeName, "img": i.mainImageUrl, "code": i.code } });
|
||||||
console.log("VALUES=", options_items.value);
|
console.log("VALUES=", options_items.value);
|
||||||
|
|||||||
Reference in New Issue
Block a user