search suggestions start
This commit is contained in:
parent
976ef63810
commit
30fb46db2a
|
|
@ -113,7 +113,7 @@ class Products extends ProductController
|
|||
return response()->json(['message' => 'not found'],404);
|
||||
}
|
||||
|
||||
public function search(BrandRepository $brandRepository){
|
||||
public function suggestions(BrandRepository $brandRepository){
|
||||
|
||||
$key = request('search');
|
||||
|
||||
|
|
@ -128,9 +128,9 @@ class Products extends ProductController
|
|||
->limit(10)
|
||||
->get();
|
||||
|
||||
$products = $this->productRepository->getAll()->only('id','name');
|
||||
// $products = $this->productRepository->getAll()->only('id','name');
|
||||
|
||||
return $products;
|
||||
return $brands;
|
||||
|
||||
if($brands->count() >0){
|
||||
foreach($brands as $brand) {
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ Route::group(['prefix' => 'api'], function () {
|
|||
|
||||
//Product routes
|
||||
Route::get('products', [Products::class, 'index']);
|
||||
Route::get('products/search', [Products::class, 'search']);
|
||||
Route::get('products/search', [Products::class, 'suggestions']);
|
||||
Route::get('products/{id}', [Products::class, 'get']);
|
||||
Route::get('products/{id}/variants', [Products::class, 'variants']);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue