Skip to content

Commit 6df573e

Browse files
committed
retheme admin users list
1 parent fd5b74c commit 6df573e

File tree

2 files changed

+91
-1
lines changed

2 files changed

+91
-1
lines changed

app/Http/Controllers/Admin/UserController.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,14 @@ public function __construct()
4747
// @TODO: implement nicolaslopezj/searchable to clean up this disaster.
4848
public function getIndex(Request $request)
4949
{
50+
$users = User::withCount('servers');
51+
52+
if (! is_null($request->input('query'))) {
53+
$users->search($request->input('query'));
54+
}
55+
5056
return view('admin.users.index', [
51-
'users' => User::paginate(25),
57+
'users' => $users->paginate(25),
5258
]);
5359
}
5460

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
{{-- Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com> --}}
2+
3+
{{-- Permission is hereby granted, free of charge, to any person obtaining a copy --}}
4+
{{-- of this software and associated documentation files (the "Software"), to deal --}}
5+
{{-- in the Software without restriction, including without limitation the rights --}}
6+
{{-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell --}}
7+
{{-- copies of the Software, and to permit persons to whom the Software is --}}
8+
{{-- furnished to do so, subject to the following conditions: --}}
9+
10+
{{-- The above copyright notice and this permission notice shall be included in all --}}
11+
{{-- copies or substantial portions of the Software. --}}
12+
13+
{{-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR --}}
14+
{{-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, --}}
15+
{{-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE --}}
16+
{{-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER --}}
17+
{{-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, --}}
18+
{{-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE --}}
19+
{{-- SOFTWARE. --}}
20+
@extends('layouts.admin')
21+
22+
@section('title')
23+
List Users
24+
@endsection
25+
26+
@section('content-header')
27+
<h1>Users<small>All registered users on the system.</small></h1>
28+
<ol class="breadcrumb">
29+
<li><a href="{{ route('admin.index') }}">Admin</a></li>
30+
<li class="active">Users</li>
31+
</ol>
32+
@endsection
33+
34+
@section('content')
35+
<div class="row">
36+
<div class="col-xs-12">
37+
<div class="box box-primary">
38+
<div class="box-header with-border">
39+
<h3 class="box-title">User List</h3>
40+
<div class="box-tools">
41+
<form action="{{ route('admin.users') }}" method="GET">
42+
<div class="input-group input-group-sm" style="width: 300px;">
43+
<input type="text" name="query" class="form-control pull-right" value="{{ request()->input('query') }}" placeholder="Search">
44+
<div class="input-group-btn">
45+
<button type="submit" class="btn btn-default"><i class="fa fa-search"></i></button>
46+
<a href="{{ route('admin.users.new') }}"><button type="button" class="btn btn-sm btn-primary" style="border-radius: 0 3px 3px 0;margin-left:-1px;">Create New</button></a>
47+
</div>
48+
</div>
49+
</form>
50+
</div>
51+
</div>
52+
<div class="box-body table-responsive no-padding">
53+
<table class="table table-hover">
54+
<thead>
55+
<tr>
56+
<th>ID</td>
57+
<th>Email</td>
58+
<th>Client Name</th>
59+
<th>Username</th>
60+
<th>Servers</th>
61+
<th></th>
62+
</tr>
63+
</thead>
64+
<tbody>
65+
@foreach ($users as $user)
66+
<tr class="align-middle">
67+
<td><code>{{ $user->id }}</code></td>
68+
<td><a href="{{ route('admin.users.view', $user->id) }}">{{ $user->email }}</a></td>
69+
<td>{{ $user->name_last }}, {{ $user->name_first }}</td>
70+
<td>{{ $user->username }}</td>
71+
<td>{{ $user->servers_count }}</td>
72+
<td class="text-center"><img src="https://www.gravatar.com/avatar/{{ md5(strtolower($user->email)) }}?s=20" class="img-circle" /></td>
73+
</tr>
74+
@endforeach
75+
</tbody>
76+
</table>
77+
</div>
78+
<div class="box-footer with-border">
79+
<div class="col-md-12 text-center">{!! $users->render() !!}</div>
80+
</div>
81+
</div>
82+
</div>
83+
</div>
84+
@endsection

0 commit comments

Comments
 (0)