Add category related products
This commit is contained in:
parent
a8025f1b06
commit
6eee2aaaca
|
|
@ -37,6 +37,11 @@ class Products extends ProductController
|
||||||
return ProductResource::collection($this->productRepository->getAll(request()->input('category')));
|
return ProductResource::collection($this->productRepository->getAll(request()->input('category')));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getCurrentProduct(ProductRepository $prodRep, $id)
|
||||||
|
{
|
||||||
|
return ProductResource::collection($prodRep->getProductsRelatedToCategoryNurgul($id, request('perPage')));
|
||||||
|
}
|
||||||
|
|
||||||
public function home(SliderRepository $sliderRepository,)
|
public function home(SliderRepository $sliderRepository,)
|
||||||
{
|
{
|
||||||
// $data = [
|
// $data = [
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,7 @@ Route::group(['prefix' => 'api'], function () {
|
||||||
Route::get('products-search', [Products::class, 'searchProducts']);
|
Route::get('products-search', [Products::class, 'searchProducts']);
|
||||||
Route::get('suggestions', [\Sarga\API\Http\Controllers\SearchController::class, 'index']);
|
Route::get('suggestions', [\Sarga\API\Http\Controllers\SearchController::class, 'index']);
|
||||||
Route::get('products/{id}', [Products::class, 'get']);
|
Route::get('products/{id}', [Products::class, 'get']);
|
||||||
|
Route::get('products/related/{id}', [Products::class, 'getCurrentProduct']);
|
||||||
Route::get('products/{id}/variants', [Products::class, 'variants']);
|
Route::get('products/{id}/variants', [Products::class, 'variants']);
|
||||||
|
|
||||||
Route::get('states', [ResourceController::class, 'index'])->defaults('_config', [
|
Route::get('states', [ResourceController::class, 'index'])->defaults('_config', [
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue