header('X-API-COMPANY-KEY'))->firstOrFail(); if (! $company->enable_shop_api) { return response()->json(['message' => 'Shop is disabled', 'errors' => new stdClass], 403); } $products = Product::where('company_id', $company->id); return $this->listResponse($products); } public function show(Request $request, string $product_key) { $company = Company::where('company_key', $request->header('X-API-COMPANY-KEY'))->firstOrFail(); if (! $company->enable_shop_api) { return response()->json(['message' => 'Shop is disabled', 'errors' => new stdClass], 403); } $product = Product::where('company_id', $company->id) ->where('product_key', $product_key) ->first(); return $this->itemResponse($product); } }