mirror of
https://github.com/v2board/v2board.git
synced 2025-01-31 02:29:14 +08:00
update
This commit is contained in:
parent
c1187b8d51
commit
adcec73982
26
app/Http/Controllers/Admin/UserController.php
Normal file
26
app/Http/Controllers/Admin/UserController.php
Normal 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
|
||||
]);
|
||||
}
|
||||
}
|
@ -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')
|
||||
|
Loading…
Reference in New Issue
Block a user