This commit is contained in:
root 2019-10-24 19:30:16 +08:00
parent c1187b8d51
commit adcec73982
2 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,26 @@
<?php
namespace App\Http\Controllers\Admin;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Models\Order;
use App\Models\User;
class UserController extends Controller
{
public function index (Request $request) {
$current = $request->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
]);
}
}

View File

@ -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')