mirror of
https://gitlab.com/izyim/prototypes/lumen-microservices/microservice-api-gateway.git
synced 2026-08-24 06:54:42 +00:00
fixing missed step
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types = 1);
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Services\ProductService;
|
||||
@@ -10,33 +12,62 @@ class ProductController extends Controller
|
||||
|
||||
private $productService;
|
||||
|
||||
/**
|
||||
* ProductController constructor.
|
||||
*
|
||||
* @param \App\Services\ProductService $productService
|
||||
*/
|
||||
public function __construct(ProductService $productService)
|
||||
{
|
||||
$this->productService = $productService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return $this->successResponse($this->productService->fetchProducts());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $product
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function show($product)
|
||||
{
|
||||
return $this->successResponse($this->productService->fetchProduct($product));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
return $this->successResponse($this->productService->createProduct($request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param $product
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function update(Request $request, $product)
|
||||
{
|
||||
return $this->successResponse($this->productService->updateProduct($product, $request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $product
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function destroy($product)
|
||||
{
|
||||
return $this->successResponse($this->productService->deleteProduct($product));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user