Skip to content

Commit

Permalink
fix add order search by eamil
Browse files Browse the repository at this point in the history
  • Loading branch information
xxl4 committed Jul 11, 2024
1 parent 95e3956 commit 9bf4689
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Http/Controllers/Api/V1/Admin/Sales/OrderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,21 @@ public function resource(): string
return OrderResource::class;
}

/**
* Search all the orders.
*
* @return \Illuminate\Http\Response
*/
public function search(Request $request)
{
$validatedData = $request->validate([
'email' => 'required',
]);
$results = $this->getRepositoryInstance()->search($request->all());

return $this->resource()::collection($results);
}

/**
* Cancel action for the specified resource.
*
Expand Down
2 changes: 2 additions & 0 deletions src/Routes/V1/Admin/sales-routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
Route::controller(OrderController::class)->prefix('orders')->group(function () {
Route::get('', 'allResources');

Route::get('search', 'search');

Route::get('{id}', 'getResource');

Route::post('{id}/cancel', 'cancel');
Expand Down

0 comments on commit 9bf4689

Please sign in to comment.