Commit 5f2ed7da authored by 20194288-huannh's avatar 20194288-huannh

cho phép lọc theo danh sách key cụ thể

parent f39ee5a5
...@@ -24,10 +24,10 @@ public function __construct(OrderRepository $orderRepository) ...@@ -24,10 +24,10 @@ public function __construct(OrderRepository $orderRepository)
} }
public function index(GetOrderRequest $request) public function index(GetOrderRequest $request)
{ {
$user = auth('api')->user(); $user = auth()->user();
$order = $user->role == User::ROLE_ADMIN ? $order = $user->role == User::ROLE_ADMIN ?
$this->orderRepository->getListOrder($request->all()) $this->orderRepository->getListOrder($request->only(['keyword', 'status']))
: $this->orderRepository->getListOrder($request->all(), $user->id); : $this->orderRepository->getListOrder($request->only(['keyword', 'status']), $user->id);
return response()->json([ return response()->json([
'success' => true, 'success' => true,
'meta' => [ 'meta' => [
......
...@@ -25,8 +25,8 @@ public function index(GetOrderRequest $request) ...@@ -25,8 +25,8 @@ public function index(GetOrderRequest $request)
{ {
$user = auth('api')->user(); $user = auth('api')->user();
$order = $user->role == User::ROLE_ADMIN ? $order = $user->role == User::ROLE_ADMIN ?
$this->orderRepository->getListOrder($request->all()) $this->orderRepository->getListOrder($request->only(['status', 'keyword']))
: $this->orderRepository->getListOrder($request->all(), $user->id); : $this->orderRepository->getListOrder($request->only(['status', 'keyword']), $user->id);
return response()->json([ return response()->json([
'success' => true, 'success' => true,
'meta' => [ 'meta' => [
......
...@@ -25,7 +25,7 @@ public function rules() ...@@ -25,7 +25,7 @@ public function rules()
{ {
return [ return [
'status' => 'integer', 'status' => 'integer',
'keyword' => 'max:255' 'keyword' => 'string|max:255'
]; ];
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment