/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($slug) { $productSubCategory = ProductSubCategory::whereSlug($slug)->first(); return response()->json(['productSubCategory' => $productSubCategory]); }
public function allProductsApi() { $productList = Product::all(); $categories = ProductSubCategory::all(); foreach ($categories as $category) { } return response()->json(['response_message' => 'success', 'response_rows' => sizeof($productList), 'response_data' => $productList]); }