parent
23e6e0510b
commit
6fda3b72e4
4 changed files with 17 additions and 5 deletions
|
@ -44,7 +44,7 @@ class UserController extends Controller
|
|||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
$users = User::withCount('servers');
|
||||
$users = User::withCount('servers', 'subuserOf');
|
||||
|
||||
if (! is_null($request->input('query'))) {
|
||||
$users->search($request->input('query'));
|
||||
|
|
|
@ -239,4 +239,14 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac
|
|||
{
|
||||
return $this->hasMany(Server::class, 'owner_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all servers that user is listed as a subuser of directly.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function subuserOf()
|
||||
{
|
||||
return $this->hasMany(Subuser::class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,8 @@
|
|||
<th>Email</td>
|
||||
<th>Client Name</th>
|
||||
<th>Username</th>
|
||||
<th>Servers</th>
|
||||
<th class="text-center" data-toggle="tooltip" data-placement="top" title="Servers that this user is marked as the owner of.">Servers Owned</th>
|
||||
<th class="text-center" data-toggle="tooltip" data-placement="top" title="Servers that this user can access because they are marked as a subuser.">Can Access</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -68,7 +69,8 @@
|
|||
<td><a href="{{ route('admin.users.view', $user->id) }}">{{ $user->email }}</a></td>
|
||||
<td>{{ $user->name_last }}, {{ $user->name_first }}</td>
|
||||
<td>{{ $user->username }}</td>
|
||||
<td>{{ $user->servers_count }}</td>
|
||||
<td class="text-center">{{ $user->servers_count }}</td>
|
||||
<td class="text-center">{{ $user->subuser_of_count }}</td>
|
||||
<td class="text-center"><img src="https://www.gravatar.com/avatar/{{ md5(strtolower($user->email)) }}?s=20" class="img-circle" /></td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
|
|
@ -136,9 +136,9 @@
|
|||
<td><a href="{{ route('admin.servers.view', $server->id) }}">{{ $server->name }}</a></td>
|
||||
<td>
|
||||
@if($server->owner_id === $user->id)
|
||||
@lang('strings.owner')
|
||||
<span class="label bg-purple">Owner</span>
|
||||
@else
|
||||
@lang('strings.subuser')
|
||||
<span class="label bg-blue">Subuser</span>
|
||||
@endif
|
||||
</td>
|
||||
<td><a href="{{ route('admin.nodes.view', $server->node->id) }}">{{ $server->node->name }}</a></td>
|
||||
|
|
Loading…
Reference in a new issue