From adcec73982fa877b2bfafa6b08d7131e7da40953 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 24 Oct 2019 19:30:16 +0800 Subject: [PATCH] update --- app/Http/Controllers/Admin/UserController.php | 26 +++++++++++++++++++ routes/api.php | 2 ++ 2 files changed, 28 insertions(+) create mode 100644 app/Http/Controllers/Admin/UserController.php diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php new file mode 100644 index 00000000..5e825053 --- /dev/null +++ b/app/Http/Controllers/Admin/UserController.php @@ -0,0 +1,26 @@ +input('current') ? $request->input('current') : 1; + $pageSize = $request->input('pageSize') >= 10 ? $request->input('pageSize') : 10; + $userModel = User::orderBy('created_at', 'DESC'); + if ($request->input('email')) { + $userModel->where('email', $request->input('email')); + } + $total = $userModel->count(); + return response([ + 'data' => $userModel->forPage($current, $pageSize) + ->get(), + 'total' => $total + ]); + } +} diff --git a/routes/api.php b/routes/api.php index 0c8275d4..34409608 100755 --- a/routes/api.php +++ b/routes/api.php @@ -37,6 +37,8 @@ Route::prefix('v1') // Order Route::get('order', 'Admin\\OrderController@index'); Route::post('order/repair', 'Admin\\OrderController@repair'); + // User + Route::get('user', 'Admin\\UserController@index'); }); // User Route::prefix('user')