mirror of
https://github.com/Deathgarden-Rebirth/Deathgarden_Rebirth-Rewrite.git
synced 2026-09-09 03:35:14 -05:00
Added User List admin tool
Also added the default laravel pagination to tailwind.config.js
This commit is contained in:
36
dist/app/Http/Controllers/Web/Admin/Tools/UsersController.php
vendored
Normal file
36
dist/app/Http/Controllers/Web/Admin/Tools/UsersController.php
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Web\Admin\Tools;
|
||||
|
||||
use App\Enums\Auth\Permissions;
|
||||
use App\Models\User\User;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UsersController extends AdminToolController
|
||||
{
|
||||
protected static string $name = 'Users';
|
||||
|
||||
protected static string $description = 'View and Manage Users';
|
||||
|
||||
protected static string $iconComponent = 'icons.users';
|
||||
|
||||
protected static Permissions $neededPermission = Permissions::USER_MANAGEMENT;
|
||||
|
||||
const PER_PAGE = 10;
|
||||
|
||||
public function index(Request $request)
|
||||
{
|
||||
$searchString = $request->input('search');
|
||||
$query = User::orderBy('last_known_username');
|
||||
|
||||
if($searchString !== null) {
|
||||
$query->orWhere('id', 'LIKE', '%'.$searchString.'%')
|
||||
->orWhere('steam_id', 'LIKE', '%'.$searchString.'%')
|
||||
->orWhere('last_known_username', 'LIKE', '%'.$searchString.'%');
|
||||
}
|
||||
|
||||
$users = $query->paginate(static::PER_PAGE);
|
||||
|
||||
return view('admin.tools.user-list', ['userList' => $users, 'searchString' => $searchString]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user