|
@@ -0,0 +1,31 @@
|
|
|
|
|
+<?php
|
|
|
|
|
+
|
|
|
|
|
+namespace App\Http\Controllers\admin;
|
|
|
|
|
+
|
|
|
|
|
+use App\Constants\HttpStatus;
|
|
|
|
|
+use App\Http\Controllers\Controller;
|
|
|
|
|
+use App\Services\BackflowService;
|
|
|
|
|
+use Exception;
|
|
|
|
|
+use Illuminate\Validation\ValidationException;
|
|
|
|
|
+
|
|
|
|
|
+class Backflow extends Controller
|
|
|
|
|
+{
|
|
|
|
|
+ function index()
|
|
|
|
|
+ {
|
|
|
|
|
+ try {
|
|
|
|
|
+ $params = request()->validate([
|
|
|
|
|
+ 'page' => ['required', 'integer', 'min:1'],
|
|
|
|
|
+ 'limit' => ['required', 'integer', 'min:1'],
|
|
|
|
|
+ 'member_id' => ['nullable', 'string'],
|
|
|
|
|
+ ]);
|
|
|
|
|
+ $params['page'] = request()->input('page', 1);
|
|
|
|
|
+ $params['limit'] = request()->input('limit', 10);
|
|
|
|
|
+ $result = BackflowService::paginate($params);
|
|
|
|
|
+ } catch (ValidationException $e) {
|
|
|
|
|
+ return $this->error(HttpStatus::CUSTOM_ERROR, $e->validator->errors()->first());
|
|
|
|
|
+ } catch (Exception $e) {
|
|
|
|
|
+ return $this->error($e->getCode(), $e->getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ return $this->success($result);
|
|
|
|
|
+ }
|
|
|
|
|
+}
|