search fix

This commit is contained in:
merdan 2023-09-15 14:48:52 +05:00
parent adf9446fc3
commit 6ef8d44200
1 changed files with 5 additions and 4 deletions

View File

@ -99,11 +99,12 @@ class BrandRepository extends Repository
}
public function search($key){
$brands = $this->getModel()::search(implode(' OR ', $key))
// ->where('status',1)
// ->orderBy('name','asc')
$brands = $this->getModel()::search(implode(' OR ', $key),function($meilisearch, $query, $options){
$options['sort'] = ['name:asc'];
return $meilisearch->rawSearch($query, $options);
})
->take(10)
->query(fn ($query) => $query->select('id','name')->orderBy('name'))
->query(fn ($query) => $query->select('id','name'))
->get();
return $brands;