This commit is contained in:
frederikpyt 2020-08-03 13:50:34 +02:00
commit ae14081221
3 changed files with 8 additions and 13 deletions

View File

@ -38,7 +38,8 @@ class UserController extends Controller
*/ */
public function index(Request $request) public function index(Request $request)
{ {
$users = User::query()->paginate($request->query("page", 20)); //$users = User::query()->paginate($request->query("page", 20));
$users = User::query()->orderBy('id', 'asc')->paginate(20);
return Response::detect("users.index", [ "users" => $users ]); return Response::detect("users.index", [ "users" => $users ]);
} }
@ -320,7 +321,7 @@ class UserController extends Controller
foreach ($roles as $role) { foreach ($roles as $role) {
if($user->hasRole($role)) { if($user->hasRole($role)) {
array_push($users, $user); array_push($users, $user);
break 2; break 1;
} }
} }
} }
@ -347,7 +348,7 @@ class UserController extends Controller
foreach ($roles as $role) { foreach ($roles as $role) {
if($user->hasRole($role)) { if($user->hasRole($role)) {
array_push($users, $user); array_push($users, $user);
break 2; break 1;
} }
} }
} }
@ -379,14 +380,6 @@ class UserController extends Controller
} }
//Dont delete
/*elseif ($request->isCheck === "rolle")
$users = User::query()->where('rolle', 'LIKE',$request->search.'%');*/
if(count($users) !== 0){ if(count($users) !== 0){
foreach ($users as $key => $user){ foreach ($users as $key => $user){

View File

@ -47,7 +47,6 @@
url: '{{route('feedbacks.search')}}', url: '{{route('feedbacks.search')}}',
data: {'option':$value}, data: {'option':$value},
success:function (data) { success:function (data) {
console.log($value);
$('tbody').html(data); $('tbody').html(data);
}, },
error:function (data) { error:function (data) {

View File

@ -70,13 +70,16 @@
{{ $users->links() }} {{ $users->links() }}
<script> <script>
var url = new URL(window.location.href);
var page = url.searchParams.get("page");
$('#search').on('keyup', function () { $('#search').on('keyup', function () {
$value = $(this).val(); $value = $(this).val();
$checkboxValue = $( "input:checked" ).val(); $checkboxValue = $( "input:checked" ).val();
$.ajax({ $.ajax({
type: 'get', type: 'get',
url: '{{route('users.search')}}', url: '{{route('users.search')}}',
data: {'search':$value, 'isCheck': $checkboxValue}, data: {'search':$value, 'isCheck': $checkboxValue, 'page': page },
success:function (data) { success:function (data) {
console.log($checkboxValue); console.log($checkboxValue);
$('tbody').html(data); $('tbody').html(data);