diff --git a/packages/TPS/API/Http/Controllers/Products.php b/packages/TPS/API/Http/Controllers/Products.php index a93624f1c..6ef3f6321 100644 --- a/packages/TPS/API/Http/Controllers/Products.php +++ b/packages/TPS/API/Http/Controllers/Products.php @@ -2,6 +2,7 @@ namespace TPS\API\Http\Controllers; +use Illuminate\Http\Request; use TPS\API\Http\Resources\Catalog\ProductVariant; use TPS\API\Http\Resources\Catalog\SuperAttribute; use TPS\Shop\Repositories\ProductRepository; @@ -24,6 +25,19 @@ class Products extends ProductController { return ProductRepository::class; } + /** + * Returns an individual resource. + * + * @param \Illuminate\Http\Request $request + * @param int $id + * @return \Illuminate\Http\Response + */ + public function getResource(Request $request, int $id) + { + $resourceClassName = $this->resource(); + + return new $resourceClassName($this->getRepositoryInstance()->findOrFail($id)); + } public function variants($id){ $product = $this->getRepositoryInstance()->findOrFail($id);