->allowHtml(true)
->getSearchResultsUsing(function (string $search) {
$products = Product::where(
'name',
'like',
"%{$search}%"
)->limit(50)->get();
return $users->mapWithKeys(function ($product) {
return [$product->getKey() => static::getCleanOptionString($product)];
})->toArray();
})
->getOptionLabelUsing(function ($value): string {
$product = Product::find($value);
return static::getCleanOptionString($product);
})
->allowHtml(true)
->getSearchResultsUsing(function (string $search) {
$products = Product::where(
'name',
'like',
"%{$search}%"
)->limit(50)->get();
return $users->mapWithKeys(function ($product) {
return [$product->getKey() => static::getCleanOptionString($product)];
})->toArray();
})
->getOptionLabelUsing(function ($value): string {
$product = Product::find($value);
return static::getCleanOptionString($product);
})