pagination test
This commit is contained in:
@@ -23,7 +23,26 @@ class AdminController extends Controller
|
||||
$this->middleware('role:Admin');
|
||||
}
|
||||
|
||||
public function displayUsers(Request $request) {
|
||||
public function displayUsersPaginated() {
|
||||
//Declare array variables
|
||||
$user = array();
|
||||
$permission = array();
|
||||
$userArr = array();
|
||||
|
||||
$usersArr = User::orderBy('name', 'asc')->paginate(50);
|
||||
|
||||
foreach($usersArr as $user) {
|
||||
$perms = UserPermission::where([
|
||||
'character_id' => $user->character_id,
|
||||
])->get('permission')->toArray();
|
||||
|
||||
$user->permissions = $perms;
|
||||
}
|
||||
|
||||
return view('admin.dashboard.userspaged')->with('usersArr', $usersArr);
|
||||
}
|
||||
|
||||
public function displayUsers($page) {
|
||||
//Declare array variables
|
||||
$user = array();
|
||||
$permission = array();
|
||||
@@ -53,11 +72,6 @@ class AdminController extends Controller
|
||||
$userCount = User::orderBy('name', 'asc')->count();
|
||||
//Set the amount of pages for the data
|
||||
$userPages = ceil($userCount / 50);
|
||||
|
||||
/**
|
||||
* Miscellaneous data for populating arrays
|
||||
*
|
||||
*/
|
||||
$users = User::pluck('name')->all();
|
||||
|
||||
return view('admin.dashboards.users')->with('users', $users)
|
||||
|
||||
48
resources/views/admin/dashboards/usersepaged.blade.php
Normal file
48
resources/views/admin/dashboards/usersepaged.blade.php
Normal file
@@ -0,0 +1,48 @@
|
||||
@extends('admin.layouts.b4')
|
||||
@section('content')
|
||||
<div class="container-fluid">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h2>User Information</h2>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table class="table table-striped table-bordered">
|
||||
<thead>
|
||||
<th>Name</th>
|
||||
<th>Role</th>
|
||||
<th>Permissions</th>
|
||||
<th>Action</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($userArr as $user)
|
||||
<tr>
|
||||
<td>{{ $user->name }}</td>
|
||||
<td>{{ $user->role }}</td>
|
||||
<td>
|
||||
@if($user->permission)
|
||||
@foreach($user->permissions as $perm)
|
||||
{{ implode(', ', $perm) }}
|
||||
@endforeach
|
||||
@else
|
||||
No Permissions
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
{!! Form::open(['action' => 'Dashboard\AdminController@displayModifyUser', 'method' => 'POST']) !!}
|
||||
{{ Form::hidden('user', $user->name) }}
|
||||
{{ Form::submit('Modify User', ['class' => 'btn btn-primary']) }}
|
||||
{!! Form::close() !!}
|
||||
{!! Form::open(['action' => 'Dashboard\AdminController@removeUser', 'method' => 'POST']) !!}
|
||||
{{ Form::hidden('user', $user->name) }}
|
||||
{{ Form::submit('Remove User', ['class' => 'btn btn-danger']) }}
|
||||
{!! Form::close() !!}
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ $users->links() }}
|
||||
@endsection
|
||||
@@ -1,5 +1,6 @@
|
||||
@extends('layouts.b4')
|
||||
@section('content')
|
||||
<br>
|
||||
<div class="container col-md-6">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
|
||||
@@ -25,6 +25,7 @@ Route::group(['middleware' => ['auth']], function(){
|
||||
*/
|
||||
|
||||
Route::get('/admin/dashboard/users', 'Dashboard\AdminController@displayUsers');
|
||||
Route::get('/admin/dashboard/users/pages', 'Dashboard\AdminController@displayUsersPaginated');
|
||||
Route::get('/admin/dashboard/taxes', 'Dashboard\AdminController@displayTaxes');
|
||||
Route::get('/admin/dashboard/logins', 'Dashboard\AdminController@displayAllowedLogins');
|
||||
Route::get('/admin/dashboard/purgewiki', 'Dashboard\AdminController@displayPurgeWiki');
|
||||
|
||||
Reference in New Issue
Block a user