pagination testing

This commit is contained in:
2019-10-28 23:54:33 -05:00
parent 9619fde4ed
commit cfaebed0fe
3 changed files with 32 additions and 5 deletions

View File

@@ -32,10 +32,16 @@ class AdminController extends Controller
$usersArr = User::orderBy('name', 'asc')->paginate(50);
foreach($usersArr as $user) {
$role = UserRole::where([
'character_id' => $user->character_id,
])->get();
$perms = UserPermission::where([
'character_id' => $user->character_id,
])->get('permission')->toArray();
//Setup the extra stuff needed
$user->role = $role;
$user->permissions = $perms;
}

View File

@@ -34,10 +34,6 @@ class User extends Authenticatable
protected $table = 'users';
public function getUserType() {
return User::where('user_type')->get();
}
public function role() {
return $this->hasOne('\App\Models\User\UserRole', 'character_id', 'character_id');
}
@@ -111,4 +107,30 @@ class User extends Authenticatable
public function getId() {
return $this->character_id;
}
public function getUserType() {
return User::where('user_type')->get();
}
public function getRole() {
$role = UserRole::where(['character_id' => $this->character_id])->first();
return $role->role;
}
public function getPermissionsArray() {
$perms = UserPermission::where([
'character_id' => $this->character_id,
])->get('permission')->toArray();
return $perms;
}
public function getPermissions() {
$perms = UserPermission::where([
'character_id' => $this->character_id,
])->get('permission');
return $perms;
}
}

View File

@@ -18,7 +18,6 @@
<tr>
<td>{{ $user->name }}</td>
<td>{{ $user->role }}</td>
{{ dd($user->role) }}
<td>
@if($user->permission)
@foreach($user->permissions as $perm)