mirror of
https://gitlab.com/izyim/prototypes/lumen-microservices/microservice-api-gateway.git
synced 2026-08-22 14:04:33 +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\OrderService;
|
||||
@@ -8,42 +10,74 @@ use Illuminate\Http\Request;
|
||||
|
||||
class OrderController extends Controller
|
||||
{
|
||||
/**
|
||||
* @var \App\Services\OrderService
|
||||
*/
|
||||
protected $orderService;
|
||||
|
||||
private $orderService;
|
||||
private $productService;
|
||||
/**
|
||||
* @var \App\Services\ProductService
|
||||
*/
|
||||
protected $productService;
|
||||
|
||||
/**
|
||||
* OrderController constructor.
|
||||
*
|
||||
* @param \App\Services\OrderService $orderService
|
||||
* @param \App\Services\ProductService $productService
|
||||
*/
|
||||
public function __construct(OrderService $orderService, ProductService $productService)
|
||||
{
|
||||
$this->orderService = $orderService;
|
||||
$this->productService = $productService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return $this->successResponse($this->orderService->fetchOrders());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $order
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function show($order)
|
||||
{
|
||||
return $this->successResponse($this->orderService->fetchOrder($order));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$result = $this->productService->fetchProduct($request->product_id);
|
||||
// dd($result);
|
||||
|
||||
return $this->successResponse($this->orderService->createOrder($request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param $order
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function update(Request $request, $order)
|
||||
{
|
||||
return $this->successResponse($this->orderService->updateOrder($order, $request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $order
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function destroy($order)
|
||||
{
|
||||
return $this->successResponse($this->orderService->deleteOrder($order));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user