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){ public function search($key){
$brands = $this->getModel()::search(implode(' OR ', $key)) $brands = $this->getModel()::search(implode(' OR ', $key),function($meilisearch, $query, $options){
// ->where('status',1) $options['sort'] = ['name:asc'];
// ->orderBy('name','asc') return $meilisearch->rawSearch($query, $options);
})
->take(10) ->take(10)
->query(fn ($query) => $query->select('id','name')->orderBy('name')) ->query(fn ($query) => $query->select('id','name'))
->get(); ->get();
return $brands; return $brands;