diff --git a/app/Console/Commands/AvatarDefaultMigration.php b/app/Console/Commands/AvatarDefaultMigration.php new file mode 100644 index 00000000..ba6252b9 --- /dev/null +++ b/app/Console/Commands/AvatarDefaultMigration.php @@ -0,0 +1,88 @@ +info('Running avatar migration...'); + $count = Avatar::whereChangeCount(0)->count(); + + if($count == 0) { + $this->info('Found no avatars needing to be migrated!'); + exit; + } + + $bar = $this->output->createProgressBar($count); + $this->info("Found {$count} avatars that may need to be migrated"); + + Avatar::whereChangeCount(0)->chunk(50, function($avatars) use ($bar) { + foreach($avatars as $avatar) { + if($avatar->media_path == 'public/avatars/default.png' || $avatar->thumb_path == 'public/avatars/default.png') { + continue; + } + + if(Str::endsWith($avatar->media_path, '/avatar.svg') == false) { + // do not modify non-default avatars + continue; + } + + DB::transaction(function() use ($avatar, $bar) { + + if(is_file(storage_path('app/' . $avatar->media_path))) { + @unlink(storage_path('app/' . $avatar->media_path)); + } + + if(is_file(storage_path('app/' . $avatar->thumb_path))) { + @unlink(storage_path('app/' . $avatar->thumb_path)); + } + + $avatar->media_path = 'public/avatars/default.png'; + $avatar->thumb_path = 'public/avatars/default.png'; + $avatar->change_count = $avatar->change_count + 1; + $avatar->save(); + + Cache::forget('avatar:' . $avatar->profile_id); + $bar->advance(); + }); + } + }); + + $bar->finish(); + } +} diff --git a/resources/views/admin/users/home.blade.php b/resources/views/admin/users/home.blade.php index 44ab6997..1034436a 100644 --- a/resources/views/admin/users/home.blade.php +++ b/resources/views/admin/users/home.blade.php @@ -1,17 +1,25 @@ -@extends('admin.partial.template') +@extends('admin.partial.template-full') + +@section('header') +
+
+
+
+
+@endsection @section('section')

Users


- {{--
-
+
+ {{--
Total Users - {{-- + @@ -47,7 +55,7 @@
-
+
--}}
@@ -76,10 +84,10 @@
- Avg Age + Avg Likes
-

{{$stats['avg']['age']}}

+

{{$stats['avg']['likes']}}

@@ -96,40 +104,39 @@
-
--}} +
- - - - - - + @foreach($users as $user) - + @if($user->status == 'deleted') + @continue + @endif + - - @@ -176,10 +185,23 @@ border-radius: 2px; max-width: 20px; } + +.user-row .action-row { + display: none; +} + +.user-row:hover { + background-color: #eff8ff; +} +.user-row:hover .action-row { + display: block; +} +.user-row:hover .last-active { + display: none; +} @endpush @push('scripts') - @endpush
+ ID - Avatar - + Username - Status Count + + Statuses - Storage Used + + Storage + Actions
{{$user->id}} - - + + {{$user->username}} @if($user->is_admin) @@ -144,15 +151,17 @@

- - - + + + View - - + + + Edit - - + + + Delete