search fix

This commit is contained in:
merdan 2023-09-15 15:14:11 +05:00
parent 03a8037363
commit c4fe40ebe6
1 changed files with 4 additions and 5 deletions

View File

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