From 5e0d831db1fd319810f62494c2b3c957652d7601 Mon Sep 17 00:00:00 2001 From: Steve <34465153+xxl4@users.noreply.github.com> Date: Thu, 11 Jul 2024 15:43:54 +0800 Subject: [PATCH] add findbyEmail method --- src/Http/Controllers/Api/V1/Admin/Sales/OrderController.php | 4 ++-- src/Routes/V1/Admin/sales-routes.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Http/Controllers/Api/V1/Admin/Sales/OrderController.php b/src/Http/Controllers/Api/V1/Admin/Sales/OrderController.php index 3b2924b..29796a9 100644 --- a/src/Http/Controllers/Api/V1/Admin/Sales/OrderController.php +++ b/src/Http/Controllers/Api/V1/Admin/Sales/OrderController.php @@ -31,12 +31,12 @@ public function resource(): string * * @return \Illuminate\Http\Response */ - public function search(Request $request) + public function findByEmail(Request $request) { $validatedData = $request->validate([ 'email' => 'required', ]); - $results = $this->getRepositoryInstance()->search($request->all()); + $results = $this->getRepositoryInstance()->findByEmail($request->get('email')); return $this->resource()::collection($results); } diff --git a/src/Routes/V1/Admin/sales-routes.php b/src/Routes/V1/Admin/sales-routes.php index a488b3a..7646476 100644 --- a/src/Routes/V1/Admin/sales-routes.php +++ b/src/Routes/V1/Admin/sales-routes.php @@ -17,7 +17,7 @@ Route::controller(OrderController::class)->prefix('orders')->group(function () { Route::get('', 'allResources'); - Route::get('search', 'search'); + Route::get('find-by-email', 'findByEmail'); Route::get('{id}', 'getResource');