Fixed PageNation
This commit is contained in:
parent
679de4872d
commit
e2847e9959
|
@ -39,7 +39,7 @@ class UserController extends Controller
|
|||
public function index(Request $request)
|
||||
{
|
||||
//$users = User::query()->paginate($request->query("page", 20));
|
||||
$users = User::query()->orderBy('id', 'desc')->paginate(20);
|
||||
$users = User::query()->orderBy('id', 'asc')->paginate(20);
|
||||
|
||||
return Response::detect("users.index", [ "users" => $users ]);
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ class UserController extends Controller
|
|||
foreach ($roles as $role) {
|
||||
if($user->hasRole($role)) {
|
||||
array_push($users, $user);
|
||||
break 2;
|
||||
break 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -348,7 +348,7 @@ class UserController extends Controller
|
|||
foreach ($roles as $role) {
|
||||
if($user->hasRole($role)) {
|
||||
array_push($users, $user);
|
||||
break 2;
|
||||
break 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,13 +70,16 @@
|
|||
{{ $users->links() }}
|
||||
|
||||
<script>
|
||||
var url = new URL(window.location.href);
|
||||
var page = url.searchParams.get("page");
|
||||
|
||||
$('#search').on('keyup', function () {
|
||||
$value = $(this).val();
|
||||
$checkboxValue = $( "input:checked" ).val();
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '{{route('users.search')}}',
|
||||
data: {'search':$value, 'isCheck': $checkboxValue},
|
||||
data: {'search':$value, 'isCheck': $checkboxValue, 'page': page },
|
||||
success:function (data) {
|
||||
console.log($checkboxValue);
|
||||
$('tbody').html(data);
|
||||
|
|
Loading…
Reference in New Issue