mirror of
https://gitlab.com/izyim/prototypes/lumen-microservices/microservice-api-gateway.git
synced 2026-08-19 20:44:23 +00:00
initial commit
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Services\ProductService;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ProductController extends Controller
|
||||
{
|
||||
|
||||
private $productService;
|
||||
|
||||
public function __construct(ProductService $productService)
|
||||
{
|
||||
$this->productService = $productService;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
return $this->successResponse($this->productService->fetchProducts());
|
||||
}
|
||||
|
||||
public function show($product)
|
||||
{
|
||||
return $this->successResponse($this->productService->fetchProduct($product));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
return $this->successResponse($this->productService->createProduct($request->all()));
|
||||
}
|
||||
|
||||
public function update(Request $request, $product)
|
||||
{
|
||||
return $this->successResponse($this->productService->updateProduct($product, $request->all()));
|
||||
}
|
||||
|
||||
public function destroy($product)
|
||||
{
|
||||
return $this->successResponse($this->productService->deleteProduct($product));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user