Fixed PageNation

This commit is contained in:
Neerholt 2020-08-03 13:21:47 +02:00
parent 679de4872d
commit e2847e9959
2 changed files with 7 additions and 4 deletions

View File

@ -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;
}
}
}

View File

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