product autocomplate搜索关键字使用包含条件
This commit is contained in:
parent
1b4c5bf027
commit
b61c8cf9b6
|
|
@ -268,7 +268,7 @@ class ProductRepo
|
||||||
{
|
{
|
||||||
$products = Product::query()->with('description')
|
$products = Product::query()->with('description')
|
||||||
->whereHas('description', function ($query) use ($name) {
|
->whereHas('description', function ($query) use ($name) {
|
||||||
$query->where('name', 'like', "{$name}%");
|
$query->where('name', 'like', "%{$name}%");
|
||||||
})->limit(10)->get();
|
})->limit(10)->get();
|
||||||
$results = [];
|
$results = [];
|
||||||
foreach ($products as $product) {
|
foreach ($products as $product) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue