diff --git a/app/Http/Controllers/Admin/AdminUserController.php b/app/Http/Controllers/Admin/AdminUserController.php index 766299097..441f5b305 100644 --- a/app/Http/Controllers/Admin/AdminUserController.php +++ b/app/Http/Controllers/Admin/AdminUserController.php @@ -11,6 +11,7 @@ use App\Mail\AdminMessage; use Illuminate\Support\Facades\Mail; use App\Services\ModLogService; use App\Jobs\DeletePipeline\DeleteAccountPipeline; +use App\Services\AccountService; trait AdminUserController { @@ -25,7 +26,7 @@ trait AdminUserController 'next' => $offset + 1, 'query' => $search ? '&a=search&q=' . $search : null ]; - $users = User::select('id', 'username', 'status', 'profile_id') + $users = User::select('id', 'username', 'status', 'profile_id', 'is_admin') ->orderBy($col, $dir) ->when($search, function($q, $search) { return $q->where('username', 'like', "%{$search}%"); @@ -34,7 +35,11 @@ trait AdminUserController return $q->offset(($offset * 10)); }) ->limit(10) - ->get(); + ->get() + ->map(function($u) { + $u['account'] = AccountService::get($u->profile_id, true); + return $u; + }); return view('admin.users.home', compact('users', 'pagination')); } diff --git a/resources/views/admin/users/home.blade.php b/resources/views/admin/users/home.blade.php index 973d45367..cd75062a4 100644 --- a/resources/views/admin/users/home.blade.php +++ b/resources/views/admin/users/home.blade.php @@ -20,29 +20,51 @@ + {{-- --}} - + + + - @foreach($users as $user) + @foreach($users as $key => $user) @if($user->status == 'deleted') + {{-- --}} + + + @else + {{-- --}} - + + + @@ -117,5 +174,20 @@ el.text(filesize(size, {round: 0})); }); }); + + function deleteAccount(id) { + event.preventDefault(); + if(!window.confirm('Are you sure you want to delete this account?')) { + return; + } + + axios.post('/i/admin/users/delete/' + id) + .then(res => { + swal('Account Deleted', 'Successfully deleted this account! This page will refresh once you press OK.', 'success') + .then(res => { + window.location.reload(); + }); + }) + } @endpush
+ ID + Username + Status
Count
+
+ Followers
Count
+
+ Following
Count
+
Actions
+ + {{$user->id}} + + {{$user->username}} 000 Account Deleted @@ -51,10 +73,19 @@
+ + {{$user->id}} + + @if($user->account) + + @endif {{$user->username}} @if($user->is_admin) @@ -62,6 +93,27 @@ @endif + @if($user->account) + {{$user->account['statuses_count']}} + @else + 0 + @endif + + @if($user->account) + {{$user->account['followers_count']}} + @else + 0 + @endif + + @if($user->account) + {{$user->account['following_count']}} + @else + 0 + @endif + @@ -75,6 +127,11 @@ Mod Tools + @if($user->status !== 'deleted' && !$user->is_admin) + + Delete + + @endif