mirror of
https://github.com/v2board/v2board.git
synced 2025-01-31 18:49:13 +08:00
27 lines
791 B
PHP
27 lines
791 B
PHP
|
<?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
|
||
|
]);
|
||
|
}
|
||
|
}
|